OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 SearchListFragment.java 源代码,内容仅作参考


package com.excelliance.kxqp.gs.ui.search.child;

import android.app.Activity;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.lifecycle.Observer;
import com.excean.bytedancebi.bean.BiAppUploadInfo;
import com.excean.bytedancebi.bean.BiEventClick;
import com.excean.bytedancebi.bean.BiEventPermission;
import com.excean.ggspace.main.R;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.PlatSdk;
import com.excelliance.kxqp.bean.AppBuyBean;
import com.excelliance.kxqp.bitmap.model.ThirdLink;
import com.excelliance.kxqp.bitmap.ui.a.f;
import com.excelliance.kxqp.bitmap.ui.b.i;
import com.excelliance.kxqp.community.ui.AppDetailActivity;
import com.excelliance.kxqp.gs.base.BaseLazyFragment;
import com.excelliance.kxqp.gs.base.b;
import com.excelliance.kxqp.gs.bean.AddGameBean;
import com.excelliance.kxqp.gs.bean.CityBean;
import com.excelliance.kxqp.gs.bean.NativeAppInfo;
import com.excelliance.kxqp.gs.bean.ProxyConfigHelper;
import com.excelliance.kxqp.gs.bean.SearchBean;
import com.excelliance.kxqp.gs.bean.SpecialContentBean;
import com.excelliance.kxqp.gs.dialog.ap;
import com.excelliance.kxqp.gs.dialog.g;
import com.excelliance.kxqp.gs.dialog.h;
import com.excelliance.kxqp.gs.download.j;
import com.excelliance.kxqp.gs.i.d;
import com.excelliance.kxqp.gs.main.MainActivity;
import com.excelliance.kxqp.gs.newappstore.Bean.AppGoodsBean;
import com.excelliance.kxqp.gs.newappstore.b.b;
import com.excelliance.kxqp.gs.newappstore.ui.c;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.CommonActivity;
import com.excelliance.kxqp.gs.ui.feedback.ShowFeedbackResultDialog;
import com.excelliance.kxqp.gs.ui.gaccount.GAccountActivity;
import com.excelliance.kxqp.gs.ui.question.CommonWebViewActivity;
import com.excelliance.kxqp.gs.ui.search.SubmitActivity;
import com.excelliance.kxqp.gs.ui.search.child.a;
import com.excelliance.kxqp.gs.ui.search.child.b;
import com.excelliance.kxqp.gs.ui.search.v2.SearchActivity;
import com.excelliance.kxqp.gs.util.ViewSwitcher;
import com.excelliance.kxqp.gs.util.aq;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.aw;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bf;
import com.excelliance.kxqp.gs.util.bq;
import com.excelliance.kxqp.gs.util.bs;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.bz;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.ce;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.s;
import com.excelliance.kxqp.gs.util.w;
import com.excelliance.kxqp.gs.view.refresh.PullToRefreshView;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.sdk.StatisticsBase;
import com.excelliance.kxqp.sdk.StatisticsBuilder;
import com.excelliance.kxqp.sdk.StatisticsGS;
import com.excelliance.kxqp.ui.detail.category.CC1Tag;
import com.excelliance.kxqp.ui.detail.category.CategoryListActivity;
import com.excelliance.kxqp.util.an;
import com.excelliance.staticslio.StatisticsManager;
import io.github.prototypez.service.account.request.LoginRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONObject;

public class SearchListFragment extends BaseLazyFragment<a.InterfaceC0447a> implements AbsListView.OnScrollListener, a.b {
    private PullToRefreshView C;
    private TextView D;
    private h F;
    private LinearLayout G;
    private LinearLayout H;
    private ViewSwitcher I;
    private List<ThirdLink> J;
    private ap K;
    private List<SearchBean> L;
    private ViewSwitcher M;
    private io.reactivex.b.b N;
    private io.reactivex.b.b O;
    private io.reactivex.b.b P;
    private Map<String, SearchBean> Q;
    private int R;

    ExcellianceAppInfo f11038a;
    public com.excelliance.kxqp.gs.newappstore.b.b r;
    private int s;
    private String t;
    private String u;
    private int v;
    private ListView x;
    private com.excelliance.kxqp.gs.ui.search.child.b z;
    private Set<String> w = new HashSet();
    private List<SearchBean> y = new ArrayList();
    private CityBean A = null;
    private List<CityBean> B = new ArrayList();
    private boolean E = false;
    private int S = 0;
    private String T = "手动搜索";
    private b U = new b() {
        @Override
        public String a() {
            return SearchListFragment.this.u;
        }

        @Override
        public int b() {
            return SearchListFragment.this.R;
        }
    };
    private Handler V = new Handler() {
        @Override
        public void handleMessage(Message message) {
            switch (message.what) {
                case 0:
                    aw.a(SearchListFragment.this.d, "SearchListFragment");
                    return;
                case 1:
                    int i = message.arg1;
                    Log.d("SearchListFragment", "handleMessage:MSG_SEARCH_RESPONSE-- flag = " + i);
                    if (!TextUtils.isEmpty(((a.InterfaceC0447a) SearchListFragment.this.h).b())) {
                        Toast.makeText(SearchListFragment.this.d, ((a.InterfaceC0447a) SearchListFragment.this.h).b(), 0).show();
                    }
                    if (i == 0) {
                        SearchListFragment.this.D.setVisibility(8);
                        Toast.makeText(SearchListFragment.this.e, w.e(SearchListFragment.this.e, "net_unusable"), 0).show();
                        SearchListFragment.this.z.a((String) null);
                        SearchListFragment.this.p = false;
                        return;
                    }
                    if (i == 2) {
                        SearchListFragment.this.D.setVisibility(8);
                        StatisticsGS.getInstance().uploadUserAction(SearchListFragment.this.e, 24);
                        SearchListFragment.this.a((List<SearchBean>) message.obj);
                        Log.d("SearchListFragment", "GET SUCCESS");
                        return;
                    }
                    if (i != 4) {
                        if (i == 3) {
                            SearchListFragment.this.D.setVisibility(0);
                            SearchListFragment.this.p = false;
                            return;
                        }
                        return;
                    }
                    az.d("SearchProvider", "isVisible " + SearchListFragment.this.g);
                    boolean a2 = s.a(SearchListFragment.this.y);
                    az.d("SearchListFragment", "handleMessage: isBad app" + ((a.InterfaceC0447a) SearchListFragment.this.h).a() + " empty:" + a2);
                    if (((a.InterfaceC0447a) SearchListFragment.this.h).a()) {
                        SearchListFragment.this.D.setVisibility(8);
                        SearchListFragment.this.z.h();
                    } else if (a2) {
                        if (SearchListFragment.this.g) {
                            Toast.makeText(SearchListFragment.this.e, w.e(SearchListFragment.this.e, "no_result"), 0).show();
                        }
                        SearchListFragment.this.z.h();
                    } else {
                        SearchListFragment.this.z.f();
                    }
                    SearchListFragment.this.C.setRefreshing(false);
                    return;
                case 2:
                    SearchListFragment.this.t();
                    return;
                case 3:
                    SearchListFragment.this.C.setRefreshing(false);
                    return;
                default:
                    return;
            }
        }
    };
    private com.excelliance.kxqp.bitmap.ui.a W = new com.excelliance.kxqp.bitmap.ui.a() {
        @Override
        public void a(ExcellianceAppInfo excellianceAppInfo) {
            SearchListFragment.this.f11038a = excellianceAppInfo;
            com.excelliance.kxqp.gs.router.a.a.f8074a.invokeLogin(new LoginRequest.Builder(SearchListFragment.this).build());
        }
    };
    BroadcastReceiver m = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (SearchListFragment.this.f11038a != null) {
                i.a(SearchListFragment.this.d, SearchListFragment.this.f11038a, null, 0);
            }
        }
    };
    private ViewSwitcher.b X = new ViewSwitcher.b() {
        @Override
        public void a() {
            boolean z;
            Iterator it = SearchListFragment.this.y.iterator();
            while (true) {
                if (!it.hasNext()) {
                    z = false;
                    break;
                } else if (bs.s(((SearchBean) it.next()).getPkgName())) {
                    z = true;
                    break;
                }
            }
            if (SearchListFragment.this.q()) {
                if (z || SearchListFragment.this.L == null) {
                    return;
                }
                SearchListFragment.this.y.addAll(SearchListFragment.this.L);
                SearchListFragment.this.c((List<SearchBean>) SearchListFragment.this.y);
                return;
            }
            if (z) {
                Iterator it2 = SearchListFragment.this.y.iterator();
                while (it2.hasNext()) {
                    if (bs.s(((SearchBean) it2.next()).getPkgName())) {
                        it2.remove();
                    }
                }
                SearchListFragment.this.c((List<SearchBean>) SearchListFragment.this.y);
            }
        }
    };
    private Map<String, Integer> Y = new HashMap();
    String n = null;
    String o = null;
    boolean p = false;
    PullToRefreshView.a q = new PullToRefreshView.a() {
        @Override
        public void a() {
            SearchListFragment.this.p = false;
            SearchListFragment.this.m();
        }
    };
    private ViewSwitcher.b Z = new ViewSwitcher.b() {
        @Override
        public void a() {
            SearchListFragment.this.v();
        }
    };
    private Observer<List<AppBuyBean>> aa = new Observer<List<AppBuyBean>>() {
        @Override
        public void onChanged(List<AppBuyBean> list) {
            Log.d("SearchListFragment", String.format("onChanged RankingDetailActivity/onChanged:thread(%s)", Thread.currentThread().getName()));
            if (list == null || list.size() == 0) {
                if (SearchListFragment.this.z == null || SearchListFragment.this.y == null || SearchListFragment.this.y.size() <= 0) {
                    return;
                }
                Iterator it = SearchListFragment.this.y.iterator();
                while (it.hasNext()) {
                    ((SearchBean) it.next()).getAppInfo(SearchListFragment.this.d).isBuy = 0;
                }
                SearchListFragment.this.z.notifyDataSetChanged();
                return;
            }
            if (SearchListFragment.this.z == null || SearchListFragment.this.y == null || SearchListFragment.this.y.size() <= 0) {
                return;
            }
            HashMap hashMap = new HashMap();
            for (int i = 0; i < list.size(); i++) {
                AppBuyBean appBuyBean = list.get(i);
                hashMap.put(appBuyBean.packageName, appBuyBean);
            }
            for (SearchBean searchBean : SearchListFragment.this.y) {
                if (!hashMap.containsKey(searchBean.getPkgName())) {
                    searchBean.getAppInfo(SearchListFragment.this.d).isBuy = 0;
                } else {
                    AppBuyBean appBuyBean2 = (AppBuyBean) hashMap.get(searchBean.getPkgName());
                    appBuyBean2.initData();
                    searchBean.getAppInfo(SearchListFragment.this.d).isBuy = appBuyBean2.isBuy(SearchListFragment.this.d) ? 1 : 0;
                }
            }
            SearchListFragment.this.z.notifyDataSetChanged();
        }
    };
    private b.a ab = new b.a() {
        @Override
        public void a(ExcellianceAppInfo excellianceAppInfo) {
            AppGoodsBean appGoodsBean = new AppGoodsBean();
            appGoodsBean.f7523a = excellianceAppInfo.getAppPackageName();
            appGoodsBean.f7524b = excellianceAppInfo.appName;
            appGoodsBean.c = excellianceAppInfo.getAppIconPath();
            SearchListFragment.this.a(appGoodsBean, excellianceAppInfo);
        }
    };
    private com.excelliance.kxqp.gs.download.i ac = new com.excelliance.kxqp.gs.download.i() {
        @Override
        public void a(io.reactivex.b.b bVar) {
            SearchListFragment.this.addDisposable(bVar);
        }
    };
    private j ad = new j<List<ThirdLink>>() {
        @Override
        public void a(List<ThirdLink> list) {
            SearchListFragment.this.K = new ap(SearchListFragment.this.d, list, SearchListFragment.this.ae);
            SearchListFragment.this.K.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    SearchListFragment.this.K = null;
                }
            });
            SearchListFragment.this.K.show();
        }
    };
    private d ae = new d() {
        @Override
        public void a(View view, final Object obj, final int i) {
            StringBuilder sb = new StringBuilder();
            sb.append("setThirdLinkView onClick position:");
            sb.append(i);
            sb.append(" data != null :");
            sb.append(obj != null);
            az.d("SearchListFragment", sb.toString());
            if (obj != null) {
                az.d("SearchListFragment", "setThirdLinkView onClick position:" + i + " data instanceof ThirdLink :" + (obj instanceof ThirdLink));
            }
            by.a(SearchListFragment.this.d, "sp_config").b("sp_key_anti_addiction_system_switch", false).booleanValue();
            bx.a().b(SearchListFragment.this.d);
            if (SearchListFragment.this.K != null) {
                SearchListFragment.this.K.dismiss();
            }
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    if (obj == null || !(obj instanceof ThirdLink)) {
                        return;
                    }
                    ThirdLink thirdLink = (ThirdLink) obj;
                    az.d("SearchListFragment", "setThirdLinkView onClick position:" + i + " thirdLink:" + thirdLink);
                    BiAppUploadInfo biAppUploadInfo = thirdLink.mBiAppUploadInfo;
                    if (biAppUploadInfo != null) {
                        biAppUploadInfo.keyword_search = SearchListFragment.this.u;
                    }
                    if (!TextUtils.isEmpty(thirdLink.pkgName)) {
                        bz.a().a(SearchListFragment.this.d, thirdLink.pkgName, thirdLink.sourceFromMarket, (String) null, i + 1, 1);
                    }
                    an.d(thirdLink, SearchListFragment.this.d, "SearchListFragment");
                }
            };
            if (!ce.c(SearchListFragment.this.d)) {
                boolean booleanValue = by.a(SearchListFragment.this.d, "global_config").b("sp_disable_time_error_not_notice", false).booleanValue();
                if (bf.e(SearchListFragment.this.d) && !booleanValue) {
                    new f(SearchListFragment.this.d, runnable).run();
                    return;
                }
            }
            runnable.run();
        }
    };
    private final bq.c af = new bq.c() {
        @Override
        public void a(final boolean z) {
            bq.a(SearchListFragment.this.d, new Runnable() {
                @Override
                public void run() {
                    SearchListFragment.this.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, z ? 1 : 0);
                }
            }, z);
        }
    };

    public interface b {
        String a();

        int b();
    }

    @Override
    public void onScroll(AbsListView absListView, int i, int i2, int i3) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        a(bundle);
        this.r = new com.excelliance.kxqp.gs.newappstore.b.b(this.d);
        this.M = ViewSwitcher.a(this.d);
        this.M.a(this.X);
        o();
        n();
        p();
    }

    @Override
    public void i() {
        super.i();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(this.d.getPackageName() + ".user_login_in");
        this.d.registerReceiver(this.m, intentFilter);
    }

    @Override
    public void onResume() {
        super.onResume();
        if (by.a(this.d, "sp_config").b("sp_key_is_back_from_add_friends_mini_program", false).booleanValue()) {
            com.excelliance.kxqp.bitmap.ui.d.a(this.d);
        }
    }

    private void n() {
        this.O = com.excelliance.kxqp.bitmap.ui.b.a().a(a.class).b((io.reactivex.d.d) new io.reactivex.d.d<a>() {
            @Override
            public void accept(final a aVar) throws Exception {
                tp.i(new Runnable() {
                    @Override
                    public void run() {
                        NativeAppInfo nativeAppInfo = aVar.f11077a;
                        if (nativeAppInfo == null) {
                            return;
                        }
                        String pkgName = nativeAppInfo.getPkgName();
                        int i = 0;
                        if ("added_package".equals(aVar.f11078b)) {
                            if (SearchListFragment.this.Q != null && SearchListFragment.this.Q.keySet().contains(pkgName)) {
                                if (com.excelliance.kxqp.gs.util.b.ch(SearchListFragment.this.d)) {
                                    while (i < SearchListFragment.this.y.size()) {
                                        SearchBean searchBean = (SearchBean) SearchListFragment.this.y.get(i);
                                        ExcellianceAppInfo appInfo = searchBean.getAppInfo(SearchListFragment.this.d);
                                        if (searchBean.getPkgName().equals(pkgName)) {
                                            if (appInfo.getDownloadStatus() == 0) {
                                                searchBean.isLocalApp = true;
                                                searchBean.isExistInServer = true;
                                                SearchListFragment.this.a(i, searchBean);
                                                return;
                                            }
                                            return;
                                        }
                                        i++;
                                    }
                                    return;
                                }
                                return;
                            }
                            String appName = nativeAppInfo.getAppName();
                            if (SearchListFragment.this.u.contains(appName) || appName.contains(SearchListFragment.this.u)) {
                                SearchBean searchBean2 = new SearchBean("", "", nativeAppInfo.getIconPath(), appName, "0.00", 0.0d, appName);
                                searchBean2.isLocalApp = true;
                                searchBean2.isExistInServer = false;
                                searchBean2.setPkgName(pkgName);
                                SearchListFragment.this.y.add(0, searchBean2);
                                SearchListFragment.this.z.c(SearchListFragment.this.y);
                                c cVar = new c();
                                cVar.f11080b = 0;
                                cVar.f11079a = pkgName;
                                com.excelliance.kxqp.repository.a.a(SearchListFragment.this.d).c(pkgName).observe(SearchListFragment.this, cVar);
                                return;
                            }
                            return;
                        }
                        if ("removed_package".equals(aVar.f11078b)) {
                            if (SearchListFragment.this.Q == null || !SearchListFragment.this.Q.keySet().contains(pkgName)) {
                                while (i < SearchListFragment.this.y.size()) {
                                    SearchBean searchBean3 = (SearchBean) SearchListFragment.this.y.get(i);
                                    if (pkgName.equals(searchBean3.getPkgName())) {
                                        SearchListFragment.this.y.remove(searchBean3);
                                        com.excelliance.kxqp.repository.a.a(SearchListFragment.this.d).c(pkgName).removeObservers(SearchListFragment.this);
                                        SearchListFragment.this.z.d(SearchListFragment.this.y);
                                        return;
                                    }
                                    i++;
                                }
                                return;
                            }
                            if (com.excelliance.kxqp.gs.util.b.ch(SearchListFragment.this.d)) {
                                for (int i2 = 0; i2 < SearchListFragment.this.y.size(); i2++) {
                                    SearchBean searchBean4 = (SearchBean) SearchListFragment.this.y.get(i2);
                                    ExcellianceAppInfo appInfo2 = searchBean4.getAppInfo(SearchListFragment.this.d);
                                    if (searchBean4.getPkgName().equals(pkgName)) {
                                        if (appInfo2.downloadStatus == 0) {
                                            searchBean4.isLocalApp = false;
                                            searchBean4.isExistInServer = true;
                                            SearchListFragment.this.a(i2, searchBean4);
                                            return;
                                        }
                                        return;
                                    }
                                }
                            }
                        }
                    }
                });
            }
        });
    }

    private void o() {
        this.N = com.excelliance.kxqp.bitmap.ui.b.a().a(i.c.class).b((io.reactivex.d.d) new io.reactivex.d.d<i.c>() {
            @Override
            public void accept(i.c cVar) {
                ExcellianceAppInfo a2 = cVar.a();
                if (a2 != null) {
                    SearchListFragment.this.z.a(a2);
                }
            }
        });
    }

    private void p() {
        this.P = com.excelliance.kxqp.bitmap.ui.b.a().b(i.b.class).b((io.reactivex.d.d) new io.reactivex.d.d<i.b>() {
            @Override
            public void accept(i.b bVar) throws Exception {
                if (bVar == null || TextUtils.isEmpty(bVar.a())) {
                    return;
                }
                String a2 = bVar.a();
                if (SearchListFragment.this.z != null) {
                    int count = SearchListFragment.this.z.getCount();
                    for (int i = 0; i < count; i++) {
                        ExcellianceAppInfo appInfo = SearchListFragment.this.z.getItem(i).getAppInfo(SearchListFragment.this.d);
                        if (appInfo != null && TextUtils.equals(appInfo.appPackageName, a2)) {
                            appInfo.setSubscribeState(1);
                            SearchListFragment.this.z.a(appInfo);
                            com.excelliance.kxqp.bitmap.ui.d.a(SearchListFragment.this.d, appInfo);
                            com.excelliance.kxqp.bitmap.ui.b.a().c(i.b.class);
                            return;
                        }
                    }
                }
            }
        });
    }

    private void a(Bundle bundle) {
        if (bundle == null) {
            bundle = getArguments();
            az.d("SearchListFragment", "LOVEYOU getItem3: " + bundle);
        }
        if (bundle != null) {
            int i = bundle.getInt("index", -1);
            String string = bundle.getString("keyWord");
            CityBean cityBean = (CityBean) bundle.getParcelable("bean");
            this.S = bundle.getInt("keyFromSearchType", 0);
            this.T = bundle.getString("keyBiSearchWay", "手动搜索");
            az.d("SearchListFragment", "onViewCreated index: " + i + " keyWord: " + string + " bean: " + cityBean + " biSearchWay:" + this.T + " fromType:" + this.S);
            if (cityBean != null) {
                this.B.clear();
                this.B.add(cityBean);
                this.A = cityBean;
                this.t = cityBean.getId();
            }
            if (!TextUtils.isEmpty(string)) {
                this.u = string;
                az.d("SearchListFragment", String.format("SearchListFragment/initSearchArguments:thread(%s) mKeyWord(%s)", Thread.currentThread().getName(), this.u));
            }
            if (i >= 0) {
                this.s = i;
            }
        }
    }

    public static SearchListFragment a(String str, CityBean cityBean, int i, int i2, String str2) {
        SearchListFragment searchListFragment = new SearchListFragment();
        Bundle bundle = new Bundle();
        bundle.putString("keyWord", str);
        bundle.putParcelable("bean", cityBean);
        bundle.putInt("index", i);
        bundle.putInt("keyFromSearchType", i2);
        bundle.putString("keyBiSearchWay", str2);
        bundle.putString("key_current_page_first_des", "搜索页");
        searchListFragment.b(1);
        searchListFragment.setArguments(bundle);
        return searchListFragment;
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        az.d("SearchListFragment", "LOVEYOU getItem2: " + bundle);
        if (this.h != 0 && this.z != null) {
            this.z.a((com.excelliance.kxqp.gs.ui.search.child.c) this.h);
        }
        if (com.excelliance.kxqp.gs.util.b.bh(this.d)) {
            if (com.excelliance.kxqp.gs.util.b.be(this.d) || com.excelliance.kxqp.gs.util.b.bp(this.d)) {
                com.excelliance.kxqp.repository.a.a(this.d).v().observe(this, this.aa);
            }
        }
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        bundle.putString("keyWord", this.u);
        bundle.putParcelable("bean", this.A);
        bundle.putInt("index", this.s);
        az.d("SearchListFragment", "LOVEYOU getItem outState: " + bundle);
    }

    @Override
    protected void b() {
        this.C = (PullToRefreshView) this.f.findViewById(R.id.pull_refresh);
        this.G = (LinearLayout) this.f.findViewById(R.id.cd1_layout);
        this.H = (LinearLayout) this.f.findViewById(R.id.special_content_layout);
        this.D = (TextView) this.f.findViewById(R.id.tv_no_data);
        this.x = (ListView) this.f.findViewById(R.id.search_list_view);
        if (this.z == null) {
            this.z = new com.excelliance.kxqp.gs.ui.search.child.b(this.d, this.y);
            this.z.a(this.mCompositeDisposable);
            this.z.a(this.l);
            this.z.a(this.j);
            this.z.a(this.mPageDes);
            this.z.a(this.ad);
            this.z.a(this.ab);
            this.z.a(this.U);
            this.z.a(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(SearchListFragment.this.d, (Class<?>) SubmitActivity.class);
                    intent.putExtra("search", SearchListFragment.this.a());
                    SearchListFragment.this.d.startActivity(intent);
                    if (SearchListFragment.this.d instanceof Activity) {
                        ((Activity) SearchListFragment.this.d).overridePendingTransition(w.i(SearchListFragment.this.d, "act_up_in"), w.i(SearchListFragment.this.d, "act_up_out"));
                    }
                }
            });
            this.z.a(new b.d() {
                @Override
                public void a(String str) {
                    Log.d("SearchListFragment", "setOnItemClickSend onItemClick: ");
                    Iterator it = SearchListFragment.this.y.iterator();
                    int i = -1;
                    while (it.hasNext()) {
                        i++;
                        if (((SearchBean) it.next()).getPkgName().equals(str)) {
                            break;
                        }
                    }
                    if (i < 0 || i == SearchListFragment.this.z.c()) {
                        return;
                    }
                    SearchBean searchBean = (SearchBean) SearchListFragment.this.y.get(i);
                    com.excelliance.kxqp.gs.g.c.a().b(searchBean.getAppInfo(SearchListFragment.this.d), "详情页", SearchListFragment.this.u, SearchListFragment.this.R + "");
                    ((a.InterfaceC0447a) SearchListFragment.this.h).a(searchBean.getName(), i);
                }
            });
            this.z.a(this.ac);
            this.z.a(this.af);
            this.x.setOnScrollListener(this);
            this.x.setAdapter((ListAdapter) this.z);
        }
        this.x.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                if (2 == SearchListFragment.this.z.getItemViewType(i)) {
                    return;
                }
                if (3 == SearchListFragment.this.z.getItemViewType(i)) {
                    CommonWebViewActivity.startActivity(SearchListFragment.this.getContext(), ((SearchBean) SearchListFragment.this.y.get(i)).jumpUrl);
                    BiEventClick biEventClick = new BiEventClick();
                    biEventClick.current_page = "搜索页";
                    biEventClick.button_name = SearchListFragment.this.u;
                    com.excelliance.kxqp.gs.g.c.a().a(biEventClick);
                    return;
                }
                if (i == SearchListFragment.this.z.c()) {
                    return;
                }
                SearchBean searchBean = (SearchBean) SearchListFragment.this.y.get(i);
                com.excelliance.kxqp.gs.g.c.a().b(searchBean.getAppInfo(SearchListFragment.this.d), "详情页", SearchListFragment.this.u, SearchListFragment.this.R + "");
                ((a.InterfaceC0447a) SearchListFragment.this.h).a(searchBean.getName(), i);
                SearchListFragment.this.w.add(searchBean.getPkgName());
            }
        });
        this.C.setOnRefreshListener(this.q);
        u();
    }

    private void a(Message message) {
        int i = message.what;
        String str = null;
        g gVar = new g(this.d, w.o(this.e, "theme_dialog_no_title2"), i == 7 ? "dialog_with_image" : null);
        gVar.a(new b.InterfaceC0157b() {
            @Override
            public void a(int i2, Message message2, int i3) {
                if (i2 == 7) {
                    ExcellianceAppInfo excellianceAppInfo = (ExcellianceAppInfo) message2.obj;
                    int i4 = message2.arg1;
                    if (excellianceAppInfo != null) {
                        StatisticsGS.getInstance().uploadUserAction(SearchListFragment.this.e, StatisticsBase.UA_FIRST_SEARCH_ACCOUNT_DIALOG, 2, 1);
                        SearchListFragment.this.a(i4, SearchListFragment.this.t, SearchListFragment.this.t);
                    }
                }
            }

            @Override
            public void b(int i2, Message message2, int i3) {
                ExcellianceAppInfo b2;
                if (i2 != 7 || (b2 = as.b("com.exce.wv", SearchListFragment.this.e)) == null) {
                    return;
                }
                StatisticsGS.getInstance().uploadUserAction(SearchListFragment.this.e, StatisticsBase.UA_FIRST_SEARCH_ACCOUNT_DIALOG, 3, 1);
                PlatSdk platSdk = PlatSdk.getInstance();
                platSdk.a(SearchListFragment.this.c, b2.getPath(), b2.getAppPackageName(), b2.getUid(), platSdk.a(1, SearchListFragment.this.e));
            }
        });
        if (gVar.isShowing()) {
            return;
        }
        String str2 = "";
        String str3 = "";
        if (i == 7) {
            StatisticsGS.getInstance().uploadUserAction(this.e, StatisticsBase.UA_FIRST_SEARCH_ACCOUNT_DIALOG, 1, 1);
            by.a(this.e, "sp_total_info").a(".sp.register.toast.dialog", true);
            str2 = w.e(this.e, "register_dialog_content");
            str = w.e(this.e, "btn_register_google_account");
            str3 = w.e(this.e, "btn_enter_google_play");
            gVar.d(true);
        }
        gVar.show();
        gVar.c(i);
        gVar.a(message);
        gVar.a(str2);
        gVar.a(true, str3, str);
        if (i == 7) {
            gVar.a("green_main_theme", this.e);
        }
    }

    public void d(int i) {
        String name = this.y.get(i).getName();
        StatisticsGS.getInstance().uploadUserAction(this.e, 27, this.s, name, this.t);
        com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + name));
        intent.setPackage("com.android.vending");
        a2.startActivity(0, intent);
    }

    @Override
    protected int d() {
        return w.c(this.e, "fragment_search_result");
    }

    @Override
    public a.InterfaceC0447a e() {
        return new com.excelliance.kxqp.gs.ui.search.child.c(this, this.d);
    }

    public void a(String str) {
        w();
        this.w.clear();
        this.u = str;
    }

    @Override
    public String a() {
        return this.u;
    }

    @Override
    public int c() {
        return this.s;
    }

    @Override
    public String f() {
        return cd.e(this.t);
    }

    @Override
    public void g() {
        t();
    }

    @Override
    public void j() {
        t();
    }

    @Override
    public void a(int i, List<SearchBean> list, List<ThirdLink> list2) {
        if (this.c == null || this.V == null) {
            return;
        }
        if (list2 != null) {
            az.d("SearchListFragment", "searchResponse: third_list = " + list2);
            this.J = list2;
        }
        Message obtainMessage = this.V.obtainMessage(1);
        obtainMessage.arg1 = i;
        b(list);
        if (list != null && list.size() > 0) {
            if (this.R == 0) {
                this.R = list.size();
            }
            List<AddGameBean> b2 = com.excelliance.kxqp.gs.l.f.a(this.d).b();
            HashMap hashMap = new HashMap();
            for (AddGameBean addGameBean : b2) {
                hashMap.put(addGameBean.packageName, addGameBean);
            }
            if (this.Q == null) {
                this.Q = new HashMap();
                for (int i2 = 0; i2 < list.size(); i2++) {
                    SearchBean searchBean = list.get(i2);
                    this.Q.put(searchBean.getPkgName(), searchBean);
                }
            } else {
                this.Q.clear();
                for (int i3 = 0; i3 < list.size(); i3++) {
                    SearchBean searchBean2 = list.get(i3);
                    this.Q.put(searchBean2.getPkgName(), searchBean2);
                }
            }
            for (SearchBean searchBean3 : list) {
                if (searchBean3 != null && hashMap.containsKey(searchBean3.getPkgName())) {
                    if (com.excelliance.kxqp.gs.util.b.ch(this.d)) {
                        searchBean3.isLocalApp = true;
                        searchBean3.isExistInServer = true;
                    }
                    hashMap.remove(searchBean3.getPkgName());
                }
            }
            if (hashMap.size() > 0) {
                for (AddGameBean addGameBean2 : hashMap.values()) {
                    if (this.u.contains(addGameBean2.appName) || addGameBean2.appName.contains(this.u)) {
                        SearchBean searchBean4 = new SearchBean("", "", addGameBean2.iconPath, addGameBean2.appName, "0.00", 0.0d, addGameBean2.appName);
                        searchBean4.isLocalApp = true;
                        searchBean4.isExistInServer = false;
                        searchBean4.setPkgName(addGameBean2.packageName);
                        list.add(0, searchBean4);
                    }
                }
            }
            hashMap.clear();
            b2.clear();
        }
        obtainMessage.obj = list;
        if (this.V != null) {
            this.V.sendMessage(obtainMessage);
        }
        if (com.excelliance.kxqp.bitmap.ui.b.b.c) {
            com.excelliance.kxqp.bitmap.ui.b.b.c = false;
            String b3 = by.a(this.d, "sp_config").b("_sp_key_gp_game_op_subscribe_success", "");
            if (TextUtils.isEmpty(b3)) {
                return;
            }
            by.a(this.d, "sp_config").a("_sp_key_gp_game_op_subscribe_success", "");
            int size = list.size();
            for (int i4 = 0; i4 < size; i4++) {
                ExcellianceAppInfo appInfo = list.get(i4).getAppInfo(this.d);
                if (appInfo != null && TextUtils.equals(appInfo.getAppPackageName(), b3)) {
                    Log.d("SearchListFragment", "onResume: itemData::" + appInfo);
                    i iVar = new i(this.d);
                    appInfo.fromPage = this.mPageDes.firstPage;
                    iVar.a(appInfo, this.W);
                    return;
                }
            }
        }
    }

    private void b(List<SearchBean> list) {
        if (this.R == 0) {
            com.excelliance.kxqp.gs.g.c.a().c(this.mPageDes.firstPage, this.u, this.T, list == null ? "否" : "是", (list == null || list.size() == 0) ? "是" : "否");
        }
    }

    public boolean q() {
        ViewSwitcher a2 = ViewSwitcher.a(this.d);
        return a2.a() && a2.n();
    }

    @Override
    public void a(final CC1Tag cC1Tag) {
        if (!com.excelliance.kxqp.gs.util.b.bc(this.d) || this.G == null) {
            return;
        }
        tp.i(new Runnable() {
            @Override
            public void run() {
                if (cC1Tag == null) {
                    SearchListFragment.this.G.setVisibility(8);
                    return;
                }
                if (cC1Tag.pkgNum > 10) {
                    SearchListFragment.this.G.setVisibility(0);
                    SearchListFragment.this.G.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            CategoryListActivity.startSelf(SearchListFragment.this.d, cC1Tag.tagId, cC1Tag.tag, 1, "globalSearch");
                            SearchListFragment.this.d("搜索结果栏标签-" + cC1Tag.tag);
                        }
                    });
                    TextView textView = (TextView) SearchListFragment.this.G.findViewById(R.id.tv_tag);
                    String e = w.e(SearchListFragment.this.d, "category_tag");
                    if (textView != null) {
                        if (e == null) {
                            e = "「%s」游戏";
                        }
                        textView.setText(String.format(e, cC1Tag.tag));
                    }
                }
            }
        });
    }

    public void d(String str) {
        BiEventClick biEventClick = new BiEventClick();
        biEventClick.current_page = this.mPageDes.firstPage;
        biEventClick.expose_banner_area = this.mPageDes.secondArea;
        biEventClick.page_type = "主页";
        biEventClick.button_function = "去" + str + "列表";
        com.excelliance.kxqp.gs.g.c.a().a(biEventClick);
    }

    @Override
    public void a(final SpecialContentBean specialContentBean) {
        if (this.H == null) {
            return;
        }
        tp.i(new Runnable() {
            @Override
            public void run() {
                if (specialContentBean == null) {
                    SearchListFragment.this.H.setVisibility(8);
                    return;
                }
                if (((a.InterfaceC0447a) SearchListFragment.this.h).a()) {
                    SearchListFragment.this.H.setVisibility(0);
                    ((TextView) SearchListFragment.this.H.findViewById(R.id.special_content)).setText(specialContentBean.notice);
                    if (TextUtils.isEmpty(specialContentBean.jumpname)) {
                        return;
                    }
                    Button button = (Button) SearchListFragment.this.H.findViewById(R.id.jump_btn);
                    button.setVisibility(0);
                    button.setText(specialContentBean.jumpname);
                    button.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            SearchListFragment.this.b(specialContentBean);
                        }
                    });
                    SearchListFragment.this.a(specialContentBean.jumptype, button);
                }
            }
        });
    }

    public void b(SpecialContentBean specialContentBean) {
        switch (specialContentBean.jumptype) {
            case 1:
                MainActivity.a(this.d, com.excelliance.kxqp.gs.main.c.d());
                return;
            case 2:
                MainActivity.a(this.d, com.excelliance.kxqp.gs.main.c.e());
                return;
            case 3:
                com.excelliance.kxqp.gs.ui.googlecard.d.a(this.d, GAccountActivity.class, 102);
                return;
            case 4:
                MainActivity.a(this.d);
                return;
            case 5:
                Intent intent = new Intent();
                intent.putExtra("page", 1);
                int i = R.string.download_assistance;
                if (com.excelliance.kxqp.gs.ui.home.b.a(this.d).d()) {
                    i = R.string.download_assistance32;
                }
                intent.putExtra("title", this.d.getString(i));
                intent.setComponent(new ComponentName(this.d, (Class<?>) CommonActivity.class));
                this.d.startActivity(intent);
                return;
            case 6:
                cn.d(this.d);
                return;
            default:
                return;
        }
    }

    public void a(int i, Button button) {
        ViewSwitcher a2 = ViewSwitcher.a(this.d);
        boolean z = true;
        if (i != 6) {
            switch (i) {
                case 1:
                    if (a2.a()) {
                        break;
                    }
                    z = false;
                    break;
                case 2:
                    if (a2.a()) {
                        break;
                    }
                    z = false;
                    break;
                case 3:
                    z = by.a(this.d, "sp_total_info").b("SP_GOOGLE_ACCOUNT_ENTRANCE", false).booleanValue();
                    break;
            }
        } else {
            if (!aq.i()) {
            }
            if (!bs.p(getContext())) {
            }
            z = false;
        }
        button.setVisibility(z ? 0 : 8);
    }

    public void c(List<SearchBean> list) {
        if (list == null || list.size() == 0) {
            this.z.b(this.J);
            this.z.b();
            if (this.z != null) {
                this.z.a(this.y);
                return;
            }
            return;
        }
        r();
        if (this.z != null) {
            this.z.a(this.y);
        }
    }

    public void a(List<SearchBean> list) {
        if (list == null || list.size() == 0) {
            this.z.b(this.J);
            this.z.b();
            return;
        }
        this.v = list.size();
        if (this.y != null) {
            for (SearchBean searchBean : list) {
                if (!this.y.contains(searchBean)) {
                    this.y.add(searchBean);
                }
            }
            r();
        } else {
            this.y = list;
            r();
        }
        Iterator<SearchBean> it = this.y.iterator();
        boolean q = q();
        while (it.hasNext()) {
            SearchBean next = it.next();
            if (bs.s(next.getPkgName())) {
                if (this.L == null) {
                    this.L = new ArrayList();
                    this.L.add(next);
                }
                if (!q) {
                    it.remove();
                }
            }
        }
        if (this.z != null) {
            this.z.a(this.y);
        }
    }

    private void r() {
        for (int i = 0; i < this.y.size(); i++) {
            this.Y.put(this.y.get(i).getPkgName(), Integer.valueOf(i));
            c cVar = new c();
            cVar.f11080b = i;
            cVar.f11079a = this.y.get(i).getPkgName();
            com.excelliance.kxqp.repository.a.a(this.d).c(this.y.get(i).getPkgName()).observe(this, cVar);
        }
    }

    @Override
    public void a(boolean z, int i) {
        if (s.a(this.y)) {
            return;
        }
        SearchBean searchBean = this.y.get(i);
        if (z) {
            if (com.excean.ab_builder.c.a.L(this.d)) {
                com.excelliance.kxqp.repository.b.a(this.d).a(searchBean.getName());
            }
            if (isAdded()) {
                AppDetailActivity.a(this.d, searchBean.getName(), "globalSearch", this.u);
                return;
            }
            return;
        }
        if (bs.v(this.d) == 1) {
            return;
        }
        List<com.excelliance.kxqp.gs.ui.account.c> f = as.f();
        if (f != null && f.size() > 0) {
            if (by.a(this.e, "sp_total_info").b(".sp.register.toast.dialog", false).booleanValue()) {
                a(i, this.t, this.t);
                return;
            }
            ExcellianceAppInfo b2 = as.b("com.android.vending", this.e);
            Message message = new Message();
            message.obj = b2;
            message.arg1 = i;
            message.what = 7;
            a(message);
            return;
        }
        Intent intent = new Intent(this.d.getPackageName() + ".action.global.search.start.tourist.app");
        intent.putExtra("intentUrl", "https://play.google.com/store/apps/details?id=" + searchBean.getName());
        this.d.sendBroadcast(intent);
    }

    public void m() {
        az.d("SearchListFragment", "LOVEYOU doSearch==: " + this.h);
        if (this.D == null) {
            return;
        }
        this.D.setVisibility(8);
        if (this.h != 0) {
            if (!TextUtils.equals(this.n, this.t) || !TextUtils.equals(this.o, this.u)) {
                this.p = false;
                this.y.clear();
                if (this.z != null) {
                    this.z.a();
                }
            }
            Log.d("SearchProvider", "doSearch: " + this.o + "\t" + this.u + "\t" + this.p);
            if (!this.p) {
                a((CC1Tag) null);
                a((SpecialContentBean) null);
                this.p = true;
                if (this.z != null) {
                    this.z.d();
                }
                ((a.InterfaceC0447a) this.h).a(this.s);
            } else if (s.a(this.y) && (getActivity() instanceof SearchActivity)) {
                this.D.setVisibility(8);
                ((SearchActivity) getActivity()).a();
            }
            this.n = this.t;
            this.o = this.u;
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        this.I.b(this.Z);
        if (this.r != null) {
            this.r.a();
        }
        this.d.unregisterReceiver(this.m);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        ((a.InterfaceC0447a) this.h).c();
        if (this.V != null) {
            this.V.removeCallbacksAndMessages(null);
            this.V = null;
        }
        if (this.M != null) {
            this.M.b(this.X);
        }
        if (this.N != null && !this.N.b()) {
            this.N.a();
        }
        if (this.O != null && !this.O.b()) {
            this.O.a();
        }
        if (this.P != null && !this.P.b()) {
            this.P.a();
        }
        w();
    }

    @Override
    public void onScrollStateChanged(AbsListView absListView, int i) {
        if (i == 0) {
            if (this.z.getCount() - 1 == this.x.getLastVisiblePosition()) {
                this.z.e();
            }
            this.E = false;
            return;
        }
        this.E = true;
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        Log.e("SearchListFragment", "fuck [data: " + intent + ",code:" + i2 + "]");
        if (i != 1) {
            return;
        }
        if (i2 != -1) {
            if (i2 == 0) {
                tp.d(new Runnable() {
                    @Override
                    public void run() {
                        by a2 = by.a(SearchListFragment.this.d, "sp_pre_account_config");
                        StatisticsGS.getInstance().uploadUserAction(SearchListFragment.this.d, 47);
                        String b2 = a2.b("sp_pre_account_config", "");
                        az.i("SearchListFragment", "onActivityResult: ----config: " + b2);
                        if (TextUtils.equals(b2, "")) {
                            return;
                        }
                        as.a(SearchListFragment.this.d, 0, b2);
                        a2.a("sp_pre_account_config", "");
                    }
                });
                return;
            }
            return;
        }
        getActivity().setResult(-1, intent);
        this.V.sendMessageDelayed(this.V.obtainMessage(0), 200L);
        try {
            Intent intent2 = new Intent();
            String packageName = this.d.getPackageName();
            intent2.setComponent(new ComponentName(packageName, "com.excelliance.kxqp.gs.service.CustomIntentService"));
            intent2.setAction(packageName + ".google.account.add.success");
            this.d.startService(intent2);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (com.excelliance.kxqp.gs.util.b.cb(this.d)) {
            com.excelliance.kxqp.gs.ui.gaccount.receive.a.a(this.d).a();
        }
    }

    public void a(final int i, String str, final String str2) {
        tp.d(new Runnable() {
            @Override
            public void run() {
                if (!GameUtil.b()) {
                    PlatSdk.getInstance().initVM((Application) SearchListFragment.this.d.getApplicationContext());
                }
                boolean b2 = GameUtil.b();
                Log.d("SearchListFragment", ">>> ptLoaded.... " + b2);
                if (b2) {
                    String z = as.z(SearchListFragment.this.e);
                    Log.d("SearchListFragment", ">>> ... " + z + " netRegin..." + str2);
                    SearchListFragment.this.s();
                    if (!TextUtils.equals(z, str2)) {
                        by.a(SearchListFragment.this.e, "sp_total_info").a("sp_disconnectioin", false);
                        com.excelliance.kxqp.gs.g.c.a().b(SearchListFragment.this.e, "是");
                        int switchProxy = ProxyConfigHelper.switchProxy(SearchListFragment.this.e, str2, true);
                        if (switchProxy == 1) {
                            as.a(SearchListFragment.this.e, as.m(SearchListFragment.this.e, str2));
                            Intent intent = new Intent();
                            intent.putExtra("state", switchProxy);
                            intent.setAction(SearchListFragment.this.e.getPackageName() + "regresh.current.connect.area");
                            SearchListFragment.this.e.sendBroadcast(intent);
                        }
                    }
                    as.j();
                    SearchListFragment.this.d(i);
                }
            }
        });
    }

    public void s() {
        if (this.V != null) {
            this.V.sendMessage(this.V.obtainMessage(2));
        }
    }

    public void t() {
        if (this.F == null) {
            this.F = new h(this.d);
        }
        if (!this.F.isShowing()) {
            this.F.a(w.e(this.e, "switch_now"));
        } else {
            this.F.dismiss();
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        if (this.F == null || !this.F.isShowing()) {
            return;
        }
        this.F.dismiss();
    }

    public void a(int i, SearchBean searchBean) {
        int firstVisiblePosition;
        View childAt;
        if (this.E || (firstVisiblePosition = i - this.x.getFirstVisiblePosition()) < 0 || (childAt = this.x.getChildAt(firstVisiblePosition)) == null) {
            return;
        }
        this.z.a(childAt, searchBean, i);
    }

    public class c implements Observer<ExcellianceAppInfo> {

        public String f11079a;

        public int f11080b;

        c() {
        }

        @Override
        public void onChanged(ExcellianceAppInfo excellianceAppInfo) {
            boolean z = true;
            if (excellianceAppInfo != null) {
                Log.d("SearchListFragment", "onChanged: name = " + excellianceAppInfo.getAppName() + ", progress = " + excellianceAppInfo.getDownloadProgress() + "  finalI:" + this.f11080b);
                if (this.f11080b >= SearchListFragment.this.y.size()) {
                    return;
                }
                Iterator it = SearchListFragment.this.y.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        z = false;
                        break;
                    }
                    SearchBean searchBean = (SearchBean) it.next();
                    if (!searchBean.isKolEvent && excellianceAppInfo.appPackageName.equals(searchBean.getPkgName())) {
                        break;
                    }
                }
                if (z) {
                    ExcellianceAppInfo appInfo = ((SearchBean) SearchListFragment.this.y.get(this.f11080b)).getAppInfo(SearchListFragment.this.d);
                    if (appInfo != null) {
                        excellianceAppInfo.isBuy = appInfo.isBuy;
                        excellianceAppInfo.buttonText = appInfo.buttonText;
                        excellianceAppInfo.buttonStatus = appInfo.buttonStatus;
                    }
                    ((SearchBean) SearchListFragment.this.y.get(this.f11080b)).setAppInfo(excellianceAppInfo);
                    SearchListFragment.this.a(this.f11080b, (SearchBean) SearchListFragment.this.y.get(this.f11080b));
                    return;
                }
                return;
            }
            az.d("SearchListFragment", "onChanged: null pkg = " + this.f11079a + "  finalI:" + this.f11080b);
            if (SearchListFragment.this.y == null || SearchListFragment.this.y.size() <= 0) {
                return;
            }
            az.d("SearchListFragment", "onChanged: 1 null pkg = " + this.f11079a + "  finalI:" + this.f11080b);
            if (this.f11080b >= SearchListFragment.this.y.size()) {
                return;
            }
            az.d("SearchListFragment", "onChanged: 2 null pkg = " + this.f11079a + "  finalI:" + this.f11080b);
            SearchBean searchBean2 = null;
            Iterator it2 = SearchListFragment.this.y.iterator();
            while (true) {
                if (!it2.hasNext()) {
                    break;
                }
                SearchBean searchBean3 = (SearchBean) it2.next();
                if (!searchBean3.isKolEvent && searchBean3.getPkgName().equals(this.f11079a)) {
                    searchBean2 = searchBean3;
                    break;
                }
            }
            az.d("SearchListFragment", "onChanged: searchBean_update:" + searchBean2);
            if (searchBean2 == null || searchBean2.isKolEvent || searchBean2.getAppInfo(SearchListFragment.this.d) == null || searchBean2.getAppInfo(SearchListFragment.this.d).market_install_local != 1 || !searchBean2.getAppInfo(SearchListFragment.this.d).haveApkInstalled()) {
                return;
            }
            az.d("SearchListFragment", "onChanged: 1 searchBean_update:" + searchBean2);
            searchBean2.clearMyAppinfoMarketState();
            az.d("SearchListFragment", "onChanged: 2 appinfo :" + searchBean2.getAppInfo(SearchListFragment.this.d));
            SearchListFragment.this.a(this.f11080b, (SearchBean) SearchListFragment.this.y.get(this.f11080b));
        }
    }

    private void u() {
        this.I = ViewSwitcher.a(this.d);
        this.I.a(this.Z);
        v();
    }

    public void v() {
        Context context;
        String str;
        if (this.D == null || this.d == null) {
            return;
        }
        TextView textView = this.D;
        if (this.I.c()) {
            context = this.d;
            str = "compliance_content_notice_text";
        } else {
            context = this.d;
            str = "no_content";
        }
        textView.setText(w.e(context, str));
    }

    public void a(final AppGoodsBean appGoodsBean, ExcellianceAppInfo excellianceAppInfo) {
        com.excelliance.kxqp.gs.newappstore.ui.c cVar = new com.excelliance.kxqp.gs.newappstore.ui.c((Activity) this.d, excellianceAppInfo);
        cVar.a(new c.a() {
            @Override
            public void a(View view, int i) {
                switch (i) {
                    case 1:
                        appGoodsBean.setPayMethod(1);
                        appGoodsBean.setGoodsType(6);
                        SearchListFragment.this.r.a(appGoodsBean);
                        return;
                    case 2:
                        if (!as.i(SearchListFragment.this.d, "com.tencent.mm")) {
                            cg.a(SearchListFragment.this.d, w.e(SearchListFragment.this.d, "share_sdk_not_install_wechat"));
                            return;
                        } else {
                            appGoodsBean.setPayMethod(2);
                            appGoodsBean.setGoodsType(6);
                            SearchListFragment.this.r.a(appGoodsBean);
                            return;
                        }
                    default:
                        return;
                }
            }
        });
        cVar.a(((Activity) this.d).findViewById(android.R.id.content));
    }

    private void w() {
        JSONObject jSONObject = new JSONObject();
        StringBuilder sb = new StringBuilder();
        if (TextUtils.isEmpty(this.u)) {
            return;
        }
        new JSONArray();
        for (String str : this.w) {
            if (sb.length() > 0) {
                sb.append(StatisticsManager.COMMA);
            }
            sb.append(str);
        }
        try {
            jSONObject.put("keyWord", this.u);
            jSONObject.put("clieckePkg", sb.toString());
        } catch (Exception unused) {
        }
        StatisticsBuilder.getInstance().builder().setDescription("上报游戏搜索关键词和搜索结果点击").setPriKey1(126000).setStringKey1(jSONObject.toString()).buildImmediate(this.d);
    }

    @Override
    public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (i == 0 || i == 1) {
            boolean b2 = bq.b(this.d);
            boolean e = bq.e(this.d);
            Log.d("SearchListFragment", "onRequestPermissionsResult: rationale:" + e);
            BiEventPermission biEventPermission = new BiEventPermission();
            biEventPermission.permission_type = "存储权限";
            if (!b2 && !e) {
                biEventPermission.is_succeed = "失败";
                bq.j(this.d);
            } else if (b2) {
                if (i == 1) {
                    ShowFeedbackResultDialog.a.a(this.d, this.d.getPackageName());
                    bq.a(this.d);
                } else if (this.z != null) {
                    this.z.i();
                }
                PlatSdk.h(this.d);
                biEventPermission.is_succeed = "成功";
            } else {
                biEventPermission.is_succeed = "失败";
                Toast.makeText(this.d, R.string.please_open_storage_permission, 0).show();
            }
            com.excelliance.kxqp.gs.g.c.a().a(biEventPermission);
        }
    }

    public static class a {

        public NativeAppInfo f11077a;

        public String f11078b;

        public a(NativeAppInfo nativeAppInfo, String str) {
            this.f11077a = nativeAppInfo;
            this.f11078b = str;
        }
    }

    @Override
    public void h() {
        super.h();
        if (this.z != null) {
            this.z.a(this.j);
        }
    }

    @Override
    public void k() {
        super.k();
        if (this.z != null) {
            this.z.a(this.j);
        }
    }

    public void c(int i) {
        this.S = i;
    }

    public void c(String str) {
        this.T = str;
    }
}