中建乐购 v3.2.3版本的 MD5 值为:3856d0da11f056931d64951d23a4b3b8

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


package com.shopex.westore.activity;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.qianseit.westore.ui.CircleImageView;
import com.qianseit.westore.ui.FlowRadioGroup;
import com.qianseit.westore.ui.NotifyChangedScrollView;
import com.qianseit.westore.ui.RushBuyCountDownTimerView;
import com.qianseit.westore.ui.ShareView;
import com.shopex.westore.AgentApplication;
import com.shopex.westore.DoActivity;
import com.umeng.analytics.pro.dq;
import com.zjsjtz.ecstore.R;
import fu.c;
import gp.d;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Stack;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class aq extends com.shopex.westore.b implements NotifyChangedScrollView.a, ShareView.a, d.a {
    private static final int f9166d = 1;
    private LinearLayout A;
    private ShareView B;
    private ViewGroup C;
    private JSONObject D;
    private JSONObject E;
    private JSONObject F;
    private JSONObject G;
    private JSONArray H;
    private Dialog U;
    private LinearLayout V;
    private GridView W;
    private NotifyChangedScrollView X;
    private String Y;
    private ArrayList<Boolean> Z;
    private String f9168aa;
    private String f9169ab;
    private i f9175ah;
    private ArrayList<Integer> f9176ai;
    private gp.d f9177aj;
    private boolean f9183e;
    private com.shopex.westore.h f9184f;
    private String f9185g;
    private String f9187i;
    private LayoutInflater f9188j;
    private Resources f9189k;
    private String f9190l;
    private String f9191m;
    private String f9192n;
    private int f9194p;
    private JSONObject f9195q;
    private TextView f9196r;
    private TextView f9197s;
    private LinearLayout f9198t;
    private LayoutInflater f9199u;
    private ViewGroup f9200v;
    private boolean f9203y;
    private LinearLayout f9204z;
    public final int f9167a = 0;
    public final int f9181b = 1;
    public final int f9182c = 2;
    private int f9186h = 0;
    private int f9193o = 1;
    private boolean f9201w = false;
    private int f9202x = -1;
    private HashMap<String, JSONObject> I = new HashMap<>();
    private HashMap<String, JSONObject> J = new HashMap<>();
    private HashMap<String, JSONObject> K = new HashMap<>();
    private ArrayList<JSONObject> L = new ArrayList<>();
    private ArrayList<JSONObject> M = new ArrayList<>();
    private ArrayList<JSONObject> N = new ArrayList<>();
    private ArrayList<JSONObject> O = new ArrayList<>();
    private ArrayList<String> P = new ArrayList<>();
    private HashMap<String, Integer> Q = new HashMap<>();
    private String[] R = {"周一", "周二", "周三", "周四", "周五", "周六", "周日"};
    private int[] S = {1, 2, 4, 8, 16, 32, 64};
    private int T = -1;
    private String f9170ac = "0.0";
    private int f9171ad = 1;
    private ArrayList<Integer> f9172ae = new ArrayList<>();
    private int f9173af = 0;
    private int f9174ag = 0;
    private View.OnClickListener f9178ak = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (view.getId() != R.id.custom_ok) {
                return;
            }
            if (aq.this.U != null && aq.this.U.isShowing()) {
                aq.this.U.dismiss();
            }
            FlowRadioGroup flowRadioGroup = (FlowRadioGroup) view.getTag(R.id.tag_object);
            int i2 = -1;
            String str = "";
            for (int i3 = 0; i3 < aq.this.Z.size(); i3++) {
                if (((Boolean) aq.this.Z.get(i3)).booleanValue()) {
                    str = str + aq.this.R[i3] + " ";
                    i2 += aq.this.S[i3];
                }
            }
            aq.this.T = i2;
            TextView textView = (TextView) view.getTag();
            if ("".equals(str)) {
                textView.setVisibility(8);
            } else {
                textView.setText(aq.this.mActivity.getString(R.string.custom) + ":" + str);
                textView.setVisibility(0);
            }
            flowRadioGroup.clearCheck();
        }
    };
    private View.OnClickListener f9179al = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (view instanceof RadioButton) {
                ((RadioButton) view).setChecked(true);
            } else if (view instanceof LinearLayout) {
                RadioGroup radioGroup = (RadioGroup) view.getParent();
                int childCount = radioGroup.getChildCount();
                for (int i2 = 0; i2 < childCount; i2++) {
                    LinearLayout linearLayout = (LinearLayout) radioGroup.getChildAt(i2);
                    TextView textView = (TextView) linearLayout.getChildAt(1);
                    CircleImageView circleImageView = (CircleImageView) linearLayout.getChildAt(0);
                    if (view.getId() == linearLayout.getId()) {
                        textView.setTextColor(aq.this.getResources().getColor(R.color.goods_detail_pink_textcolor));
                        circleImageView.setBorderWidth(1);
                    } else {
                        textView.setTextColor(aq.this.getResources().getColor(R.color.goods_detail_primary_textcolor));
                        circleImageView.setBorderWidth(0);
                    }
                }
            }
            if (view.getTag(R.id.tag_spec_id) == null || view.getTag(R.id.tag_spec_jsonobject) == null) {
                return;
            }
            JSONObject jSONObject = (JSONObject) view.getTag(R.id.tag_spec_jsonobject);
            aq.this.I.put((String) view.getTag(R.id.tag_spec_id), jSONObject);
            if ("配送频次".equals((String) view.getTag(R.id.confirm_alias))) {
                aq.this.f9171ad = jSONObject.optInt("spec_alias");
                aq.this.Z = null;
                if (aq.this.f9175ah != null) {
                    aq.this.f9175ah.notifyDataSetChanged();
                }
            }
            if (jSONObject.has("spec_goods_images") && !TextUtils.isEmpty(jSONObject.optString("spec_goods_images")) && (view instanceof LinearLayout)) {
                CircleImageView circleImageView2 = (CircleImageView) aq.this.findViewById(R.id.goods_detail_buy_thumb);
                circleImageView2.setBorderColor(aq.this.getActivity().getResources().getColor(R.color.red));
                circleImageView2.setBorderWidth(1);
                bo.c.a(jSONObject.optString("spec_goods_images"), circleImageView2);
            }
            if (aq.this.I.size() >= aq.this.M.size()) {
                Object[] array = aq.this.I.keySet().toArray();
                Arrays.sort(array, new Comparator<Object>() {
                    @Override
                    public int compare(Object obj, Object obj2) {
                        return Integer.parseInt(obj.toString()) - Integer.parseInt(obj2.toString());
                    }
                });
                String str = "";
                for (Object obj : array) {
                    JSONObject jSONObject2 = (JSONObject) aq.this.I.get(obj);
                    Object[] objArr = new Object[3];
                    objArr[0] = str;
                    objArr[1] = str.isEmpty() ? "" : ";";
                    objArr[2] = jSONObject2.optString("properties");
                    str = com.shopex.westore.k.a(objArr);
                }
                JSONObject jSONObject3 = (JSONObject) aq.this.J.get(str);
                if (jSONObject3 != null) {
                    aq.this.c(jSONObject3);
                }
            }
        }
    };
    private c.a f9180am = new c.a() {
        @Override
        public void task_response(String str) {
            if (aq.this.f9194p == R.id.goods_detail_justbuy) {
                com.shopex.westore.k.a(new fu.d(), new n());
                return;
            }
            com.shopex.westore.k.b((Context) aq.this.mActivity, (int) R.string.add_to_shoping_car_success);
            com.shopex.westore.k.a(new fu.d(), new d());
        }
    };

    @Override
    public void onScrollChanged(int i2, int i3, int i4, int i5) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f9189k = this.mActivity.getResources();
        this.f9188j = this.mActivity.getLayoutInflater();
        Intent intent = this.mActivity.getIntent();
        this.f9186h = intent.getIntExtra(com.shopex.westore.k.f10235g, 0);
        this.f9190l = intent.getStringExtra(com.shopex.westore.k.f10237i);
        this.f9191m = intent.getStringExtra(com.shopex.westore.k.f10247s);
        this.f9192n = intent.getStringExtra(com.shopex.westore.k.f10241m);
        this.f9187i = intent.getStringExtra(com.shopex.westore.k.f10250v);
        this.mActionBar.setShowTitleBar(false);
    }

    @Override
    public void init(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        super.init(layoutInflater, viewGroup, bundle);
        this.f9199u = this.mActivity.getLayoutInflater();
        this.rootView = layoutInflater.inflate(R.layout.test_detail_goods, (ViewGroup) null);
        this.f9177aj = new gp.d(this.rootView, this.mActivity);
        this.f9177aj.a(this);
        this.X = (NotifyChangedScrollView) this.rootView.findViewById(R.id.goods_detail_scollview);
        this.X.setOnScrollChangedListener(this);
        this.f9204z = (LinearLayout) findViewById(R.id.ll_add_count_view);
        this.A = (LinearLayout) findViewById(R.id.ll_parent_container);
        findViewById(R.id.goods_detail_addto_shopcar).setOnClickListener(this);
        findViewById(R.id.goods_detail_justbuy).setOnClickListener(this);
        findViewById(R.id.rel_brand_view).setOnClickListener(this);
        this.rootView.findViewById(R.id.goods_detail_topbar_shoppingcar).setOnClickListener(this);
        this.f9198t = (LinearLayout) this.rootView.findViewById(R.id.fragment_goods_detail_select_layout);
        this.rootView.findViewById(R.id.fragment_goods_detail_comfirm).setOnClickListener(this);
        this.rootView.findViewById(R.id.fragment_goods_detail_cancel).setOnClickListener(this);
        findViewById(R.id.goods_detail_buy_qminus).setOnClickListener(this);
        findViewById(R.id.goods_detail_buy_qplus).setOnClickListener(this);
        findViewById(R.id.goods_detail_search).setOnClickListener(this);
        findViewById(R.id.goods_detail_button_category).setOnClickListener(this);
        findViewById(R.id.goods_detail_buy_confirm).setOnClickListener(this);
        findViewById(R.id.goods_detail_buy_cancel).setOnClickListener(this);
        this.f9196r = (TextView) findViewById(R.id.goods_detail_buy_quantity);
        this.f9196r.setOnClickListener(this);
        this.f9197s = (TextView) findViewById(R.id.goods_detail_topbar_shoppingcar_count);
        findViewById(R.id.goods_detail_radio_onsale).setOnClickListener(this);
        findViewById(R.id.goods_detail_order_onsale).setOnClickListener(this);
        this.f9177aj.f19197k.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView absListView, int i2) {
            }

            @Override
            public void onScroll(AbsListView absListView, int i2, int i3, int i4) {
                if (i4 < 3 || !aq.this.f9203y || i4 - (i2 + i3) > 3) {
                    return;
                }
                aq.this.f9177aj.f19198l.a(aq.this.f9190l);
            }
        });
        this.C = (ViewGroup) findViewById(R.id.good_detail_recommend_comtain);
        this.f9200v = (ViewGroup) findViewById(R.id.goods_detail_point_area);
        this.f9200v.setLayoutParams(new AbsListView.LayoutParams(-1, -2));
        com.shopex.westore.k.a((View) this.f9200v);
        this.f9184f = AgentApplication.c(getActivity());
        this.f9185g = this.f9184f.K();
        if (this.f9186h == 1) {
            this.rootView.findViewById(R.id.goods_detail_addto_shopcar).setVisibility(4);
        }
        if (!TextUtils.isEmpty(this.f9191m)) {
            this.rootView.findViewById(R.id.goods_detail_addto_shopcar).setVisibility(4);
        }
        if (!TextUtils.isEmpty(this.f9187i)) {
            com.shopex.westore.k.a(new fu.d(), new e());
            return;
        }
        if (TextUtils.isEmpty(this.f9190l)) {
            com.shopex.westore.k.a(new fu.d(), new f());
        } else if (TextUtils.isEmpty(this.f9191m)) {
            com.shopex.westore.k.a(new fu.d(), new h(this.f9186h));
            findViewById(R.id.goods_detail_shoppingcar).setVisibility(0);
            findViewById(R.id.goods_detail_addto_shopcar).setVisibility(0);
        } else {
            com.shopex.westore.k.a(new fu.d(), new f());
        }
        this.f9177aj.f19198l.a(this.f9190l);
    }

    @Override
    public void onResume() {
        super.onResume();
        this.T = 0;
        if (AgentApplication.c(this.mActivity).c()) {
            com.shopex.westore.k.a(new fu.d(), new d());
        }
        this.f9177aj.d();
    }

    @Override
    public void onPause() {
        super.onPause();
        this.f9177aj.c();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.f9177aj = null;
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.rel_brand_view) {
            if (view.getTag() == null) {
                return;
            }
            JSONObject jSONObject = (JSONObject) view.getTag();
            this.mActivity.startActivity(AgentActivity.a(this.mActivity, 353).putExtra(com.shopex.westore.k.f10242n, jSONObject.optString("brand_name")).putExtra(com.shopex.westore.k.f10251w, jSONObject.optString("brand_id")));
        } else if (view.getId() == R.id.goods_detail_like) {
            if (TextUtils.isEmpty(this.f9190l)) {
                if (this.E == null) {
                    return;
                }
                this.f9190l = this.E.optString("iid");
            }
            if (this.f9183e) {
                com.shopex.westore.k.a(new fu.d(), new l(this.f9190l));
            } else {
                com.shopex.westore.k.a(new fu.d(), new b(this.f9190l));
            }
        } else if (view.getId() == R.id.goods_detail_radio_images || view.getId() == R.id.goods_detail_radio_props || view.getId() == R.id.goods_detail_radio_comments) {
            if (this.E == null) {
                return;
            }
            startActivity(AgentActivity.a(this.mActivity, (int) AgentActivity.L).putExtra(com.shopex.westore.k.f10241m, view.getId()).putExtra(com.shopex.westore.k.f10237i, this.f9190l).putExtra("com.shopex.westore.EXTRA_DATA", this.E.toString()));
        } else if (view.getId() == R.id.goods_detail_topbar_shoppingcar) {
            Intent intent = new Intent(getActivity(), MainTabFragmentActivity.class);
            intent.putExtra(com.shopex.westore.k.f10236h, 3);
            intent.setFlags(67108864);
            startActivity(intent);
        } else if (view.getId() == R.id.goods_detail_buy_cancel) {
            final View findViewById = findViewById(R.id.goods_detail_buy_parent);
            Animation loadAnimation = AnimationUtils.loadAnimation(this.mActivity, R.anim.push_down_out);
            loadAnimation.setAnimationListener(new com.shopex.westore.l() {
                @Override
                public void onAnimationEnd(Animation animation) {
                    aq.this.findViewById(R.id.translucent).setVisibility(8);
                    findViewById.setVisibility(8);
                }
            });
            findViewById.startAnimation(loadAnimation);
        } else if (view.getId() == R.id.goods_detail_buy_qminus) {
            if (this.f9193o <= 1) {
                return;
            }
            this.f9193o--;
            this.f9196r.setText(String.valueOf(this.f9193o));
        } else if (view.getId() == R.id.goods_detail_buy_qplus) {
            if (this.f9202x > 0) {
                if (this.f9193o < this.f9202x) {
                    this.f9193o++;
                    this.f9196r.setText(String.valueOf(this.f9193o));
                    return;
                }
                return;
            }
            this.f9193o++;
            this.f9196r.setText(String.valueOf(this.f9193o));
        } else if (view.getId() == R.id.goods_detail_addto_shopcar || view.getId() == R.id.goods_detail_justbuy) {
            if (this.f9195q == null && this.L.size() == 1) {
                this.f9195q = this.L.get(0);
            }
            if (this.f9195q == null) {
                com.shopex.westore.k.b((Context) this.mActivity, (int) R.string.please_choose_goods_properties);
                return;
            }
            e();
            if ("1".equals(this.f9168aa)) {
                if (this.T == 0) {
                    com.shopex.westore.k.b((Context) this.mActivity, (int) R.string.choose_combo_time);
                    return;
                } else if (this.f9176ai.size() < this.f9171ad) {
                    com.shopex.westore.k.b((Context) this.mActivity, (int) R.string.choose_combo_time);
                    return;
                }
            }
            this.f9194p = view.getId();
            if (this.f9195q != null) {
                String optString = this.f9195q.optString("sku_id");
                com.shopex.westore.k.a(new fu.d(), this.f9186h == 1 ? new j(optString, this.f9193o) : new a((DoActivity) this.mActivity, this.f9180am, optString, this.f9193o, this.f9194p == R.id.goods_detail_justbuy ? "is_fastbuy" : "", this.T));
            }
        } else if (view.getId() == R.id.goods_detail_radio_onsale) {
            if (this.D != null) {
                ViewGroup viewGroup = (ViewGroup) findViewById(R.id.goods_detail_promotion);
                if (viewGroup.getVisibility() == 0) {
                    viewGroup.setVisibility(8);
                } else if (viewGroup.getChildCount() < 1) {
                    JSONArray optJSONArray = this.D.optJSONArray("goods");
                    int length = optJSONArray == null ? 0 : optJSONArray.length();
                    for (int i2 = 0; i2 < length; i2++) {
                        View inflate = this.f9199u.inflate(R.layout.item_detail_promotion_view, (ViewGroup) null);
                        ((TextView) inflate.findViewById(R.id.item_detail_promotion_tag)).setText(optJSONArray.optJSONObject(i2).optString("tag"));
                        ((TextView) inflate.findViewById(R.id.item_detail_promotion_name)).setText(optJSONArray.optJSONObject(i2).optString(ca.c.f4824e));
                        viewGroup.addView(inflate);
                    }
                    viewGroup.setVisibility(length > 0 ? 0 : 8);
                } else {
                    viewGroup.setVisibility(0);
                }
            }
        } else if (view.getId() == R.id.goods_detail_search) {
            startActivity(AgentActivity.a(this.mActivity, (int) AgentActivity.f8624h));
        } else if (view.getId() == R.id.goods_detail_button_category) {
            Intent intent2 = new Intent(this.mActivity, MainTabFragmentActivity.class);
            intent2.addFlags(67108864);
            MainTabFragmentActivity.f8662c.a(1);
            startActivity(intent2);
        } else if (view != this.f9196r) {
            if (view.getId() == R.id.fragment_goods_detail_cancel) {
                Animation loadAnimation2 = AnimationUtils.loadAnimation(this.mActivity, R.anim.push_down_out);
                loadAnimation2.setAnimationListener(new com.shopex.westore.l() {
                    @Override
                    public void onAnimationEnd(Animation animation) {
                        aq.this.f9198t.setVisibility(8);
                    }
                });
                this.f9198t.startAnimation(loadAnimation2);
            } else if (view.getId() == R.id.fragment_goods_detail_comfirm) {
                this.f9196r.setText(String.valueOf(this.f9193o));
                Animation loadAnimation3 = AnimationUtils.loadAnimation(this.mActivity, R.anim.push_down_out);
                loadAnimation3.setAnimationListener(new com.shopex.westore.l() {
                    @Override
                    public void onAnimationEnd(Animation animation) {
                        aq.this.f9198t.setVisibility(8);
                    }
                });
                this.f9198t.startAnimation(loadAnimation3);
            } else if (view.getId() == R.id.goods_detail_order_onsale) {
                if (this.D != null) {
                    ViewGroup viewGroup2 = (ViewGroup) findViewById(R.id.goods_detail_order_promotion);
                    if (viewGroup2.getVisibility() == 0) {
                        viewGroup2.setVisibility(8);
                    } else if (viewGroup2.getChildCount() < 1) {
                        JSONArray optJSONArray2 = this.D.optJSONArray("order");
                        int length2 = optJSONArray2 == null ? 0 : optJSONArray2.length();
                        for (int i3 = 0; i3 < length2; i3++) {
                            View inflate2 = this.f9199u.inflate(R.layout.item_detail_promotion_view, (ViewGroup) null);
                            ((TextView) inflate2.findViewById(R.id.item_detail_promotion_tag)).setText(optJSONArray2.optJSONObject(i3).optString("tag"));
                            ((TextView) inflate2.findViewById(R.id.item_detail_promotion_name)).setText(optJSONArray2.optJSONObject(i3).optString(ca.c.f4824e));
                            viewGroup2.addView(inflate2);
                        }
                        viewGroup2.setVisibility(length2 > 0 ? 0 : 8);
                    } else {
                        viewGroup2.setVisibility(0);
                    }
                }
            } else if (view.getId() == R.id.custom_button) {
                this.U = new Dialog(this.mActivity, R.style.my_dialog);
                this.V = (LinearLayout) LayoutInflater.from(this.mActivity).inflate(R.layout.custom_dialog_time, (ViewGroup) null);
                this.W = (GridView) this.V.findViewById(R.id.custon_gv);
                this.W.setAdapter((ListAdapter) new i());
                this.U.setContentView(this.V);
                this.V.findViewById(R.id.custom_ok).setTag(R.id.tag_object, (FlowRadioGroup) view.getTag(R.id.tag_first));
                this.V.findViewById(R.id.custom_ok).setTag(view.getTag());
                this.V.findViewById(R.id.custom_ok).setOnClickListener(this.f9178ak);
                Window window = this.U.getWindow();
                window.setGravity(80);
                window.setWindowAnimations(R.style.my_dialog_style);
                WindowManager.LayoutParams attributes = window.getAttributes();
                attributes.x = 0;
                attributes.y = -20;
                attributes.width = getResources().getDisplayMetrics().widthPixels;
                this.V.measure(0, 0);
                attributes.height = this.V.getMeasuredHeight();
                attributes.alpha = 9.0f;
                window.setAttributes(attributes);
                this.U.setCanceledOnTouchOutside(true);
                this.U.show();
            } else {
                super.onClick(view);
            }
        }
    }

    public void e() {
        if (this.Z != null) {
            this.f9176ai = new ArrayList<>();
            for (int i2 = 0; i2 < this.Z.size(); i2++) {
                if (this.Z.get(i2).booleanValue()) {
                    this.f9176ai.add(Integer.valueOf(i2));
                }
            }
            Iterator<Integer> it = this.f9176ai.iterator();
            while (it.hasNext()) {
                this.T += this.S[it.next().intValue()];
            }
        }
    }

    @Override
    public void onCollectionOfGoods(View view) {
        if (TextUtils.isEmpty(this.f9190l)) {
            if (this.E == null) {
                return;
            }
            this.f9190l = this.E.optString("iid");
        }
        if (this.f9183e) {
            com.shopex.westore.k.a(new fu.d(), new l(this.f9190l));
        } else {
            com.shopex.westore.k.a(new fu.d(), new b(this.f9190l));
        }
    }

    @Override
    public void onShareGoods(View view) {
        if (TextUtils.isEmpty(a()) || TextUtils.isEmpty(c())) {
            return;
        }
        com.qianseit.westore.ui.l lVar = new com.qianseit.westore.ui.l(this.mActivity);
        lVar.a(this);
        lVar.a(this.mActionBar.getRightImageButton());
    }

    @Override
    public void onExpansionUpdate(float f2, int i2) {
        if (i2 == 3) {
            hideLoadingDialog_mt();
        }
    }

    public class i extends BaseAdapter {
        private CheckBox f9235b;
        private String f9236c;

        @Override
        public long getItemId(int i2) {
            return i2;
        }

        private i() {
        }

        @Override
        public int getCount() {
            return aq.this.R.length;
        }

        @Override
        public String getItem(int i2) {
            return aq.this.R[i2];
        }

        @Override
        public View getView(final int i2, View view, ViewGroup viewGroup) {
            View inflate = aq.this.f9199u.inflate(R.layout.custom_gridview_item, (ViewGroup) null);
            this.f9235b = (CheckBox) inflate.findViewById(R.id.custom_cb);
            String item = getItem(i2);
            this.f9235b.setTag(Integer.valueOf(i2));
            if (aq.this.Z == null) {
                aq.this.Z = new ArrayList();
                for (int i3 = 0; i3 < aq.this.R.length; i3++) {
                    aq.this.Z.add(i3, false);
                }
            }
            aq.this.a(((Boolean) aq.this.Z.get(i2)).booleanValue(), this.f9235b);
            this.f9235b.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    aq.this.f9173af = i2;
                    switch (aq.this.f9171ad) {
                        case 1:
                            aq.this.f();
                            return;
                        case 2:
                            aq.this.f();
                            return;
                        case 3:
                            aq.this.f();
                            return;
                        default:
                            return;
                    }
                }
            });
            this.f9235b.setText(item);
            return inflate;
        }
    }

    public void f() {
        if (this.Z.get(this.f9173af).booleanValue()) {
            this.Z.set(this.f9173af, false);
        } else if (!a(this.f9171ad - 1)) {
            this.Z.set(this.f9173af, Boolean.valueOf(!this.Z.get(this.f9173af).booleanValue()));
        }
        this.f9174ag = this.f9173af;
        this.f9175ah.notifyDataSetChanged();
    }

    public boolean a(int i2) {
        int i3 = -1;
        for (int i4 = 0; i4 < this.Z.size(); i4++) {
            if (this.Z.get(i4).booleanValue()) {
                i3++;
            }
        }
        return i3 == i2;
    }

    public void a(boolean z2, View view) {
        if (z2) {
            CheckBox checkBox = (CheckBox) view;
            checkBox.setBackgroundDrawable(getResources().getDrawable(R.drawable.radiobuttontrue));
            checkBox.setTextColor(getResources().getColor(R.color.white));
            return;
        }
        CheckBox checkBox2 = (CheckBox) view;
        checkBox2.setBackgroundDrawable(getResources().getDrawable(R.drawable.radiobuttonfalse));
        checkBox2.setTextColor(getResources().getColor(R.color.text_textcolor_gray1));
    }

    public void a(JSONObject jSONObject) {
        this.E = jSONObject;
        this.f9190l = this.E.optString("iid");
        com.shopex.westore.k.a(new fu.d(), new g(this.f9190l));
        this.M.clear();
        this.J.clear();
        if (jSONObject.optString("spec_time") != null && !"null".equals(jSONObject.optString("spec_time"))) {
            String optString = jSONObject.optString("spec_time");
            if (optString.length() > 0) {
                this.P = a(optString);
            }
        } else {
            this.T = 0;
        }
        this.f9183e = this.E.optBoolean("is_faved", false);
        this.f9177aj.c(this.f9183e);
        this.f9202x = jSONObject.optInt("buy_limit");
        this.Y = jSONObject.optString("share_url");
        this.D = jSONObject.optJSONObject("promotion");
        ViewGroup viewGroup = (ViewGroup) findViewById(R.id.goods_detail_promotion);
        viewGroup.removeAllViews();
        JSONArray optJSONArray = this.D.optJSONArray("goods");
        int length = optJSONArray == null ? 0 : optJSONArray.length();
        for (int i2 = 0; i2 < length; i2++) {
            View inflate = this.f9199u.inflate(R.layout.item_detail_promotion_view, (ViewGroup) null);
            ((TextView) inflate.findViewById(R.id.item_detail_promotion_tag)).setText(optJSONArray.optJSONObject(i2).optString("tag"));
            ((TextView) inflate.findViewById(R.id.item_detail_promotion_name)).setText(optJSONArray.optJSONObject(i2).optString(ca.c.f4824e));
            viewGroup.addView(inflate);
        }
        viewGroup.setVisibility(length > 0 ? 0 : 8);
        ViewGroup viewGroup2 = (ViewGroup) findViewById(R.id.goods_detail_order_promotion);
        viewGroup2.removeAllViews();
        JSONArray optJSONArray2 = this.D.optJSONArray("order");
        int length2 = optJSONArray2 == null ? 0 : optJSONArray2.length();
        for (int i3 = 0; i3 < length2; i3++) {
            View inflate2 = this.f9199u.inflate(R.layout.item_detail_promotion_view, (ViewGroup) null);
            ((TextView) inflate2.findViewById(R.id.item_detail_promotion_tag)).setText(optJSONArray2.optJSONObject(i3).optString("tag"));
            ((TextView) inflate2.findViewById(R.id.item_detail_promotion_name)).setText(optJSONArray2.optJSONObject(i3).optString(ca.c.f4824e));
            viewGroup2.addView(inflate2);
        }
        viewGroup2.setVisibility(length2 > 0 ? 0 : 8);
        JSONArray optJSONArray3 = jSONObject.optJSONArray("skus");
        if (optJSONArray3 != null && optJSONArray3.length() > 0) {
            int length3 = optJSONArray3.length();
            for (int i4 = 0; i4 < length3; i4++) {
                try {
                    JSONObject jSONObject2 = optJSONArray3.getJSONObject(i4);
                    this.J.put(jSONObject2.optString("properties"), jSONObject2);
                    this.K.put(jSONObject2.optString("sku_id"), jSONObject2);
                    this.L.add(jSONObject2);
                } catch (Exception unused) {
                }
            }
        }
        JSONArray optJSONArray4 = jSONObject.optJSONArray("props_values");
        int length4 = optJSONArray4 == null ? 0 : optJSONArray4.length();
        for (int i5 = 0; i5 < length4; i5++) {
            try {
                this.N.add(optJSONArray4.getJSONObject(i5));
            } catch (Exception unused2) {
            }
        }
        JSONArray optJSONArray5 = jSONObject.optJSONArray("spec_info");
        if (optJSONArray5 != null && optJSONArray5.length() > 0) {
            int length5 = optJSONArray5.length();
            for (int i6 = 0; i6 < length5; i6++) {
                try {
                    this.M.add(optJSONArray5.getJSONObject(i6));
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
        }
        Collections.sort(this.M, new Comparator<JSONObject>() {
            @Override
            public int compare(JSONObject jSONObject3, JSONObject jSONObject4) {
                return jSONObject3.optString("spec_id").compareTo(jSONObject4.optString("spec_id"));
            }
        });
        d(this.E);
        b(this.E);
    }

    public ArrayList<String> a(String str) {
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str2 : str.split(bl.d.f4536d)) {
            int intValue = Integer.valueOf(str2).intValue();
            String b2 = b(intValue);
            arrayList.add(b2);
            this.Q.put(b2, Integer.valueOf(intValue));
        }
        return arrayList;
    }

    public String b(int i2) {
        String str = "";
        Stack stack = new Stack();
        while (i2 != 0) {
            stack.push(Integer.valueOf(i2 % 2));
            i2 /= 2;
        }
        while (!stack.empty()) {
            str = str + stack.pop();
        }
        return b(str);
    }

    private String b(String str) {
        StringBuffer stringBuffer = new StringBuffer(str);
        String str2 = "";
        int length = str.length();
        int i2 = 0;
        while (i2 < (length / 2) + 1) {
            char charAt = str.charAt(i2);
            int i3 = length - i2;
            int i4 = i3 - 1;
            int i5 = i2 + 1;
            stringBuffer.replace(i2, i5, String.valueOf(str.charAt(i4)));
            stringBuffer.replace(i4, i3, String.valueOf(charAt));
            i2 = i5;
        }
        String str3 = new String(stringBuffer);
        for (int i6 = 0; i6 < str3.length(); i6++) {
            if (String.valueOf(str3.charAt(i6)).equals("1")) {
                str2 = str2 + this.R[i6] + " ";
            }
        }
        return str2;
    }

    private void b(JSONObject jSONObject) {
        boolean z2;
        Exception exc;
        View view;
        JSONObject jSONObject2;
        View inflate;
        LinearLayout linearLayout;
        CircleImageView circleImageView;
        this.A.removeView(this.f9204z);
        ((TextView) findViewById(R.id.goods_detail_buy_title)).setText(jSONObject.optString(dc.c.J));
        boolean z3 = true;
        if (this.f9186h == 1) {
            c(this.K.get(this.F.optJSONObject("product").optString("product_id")));
            return;
        }
        ViewGroup viewGroup = (ViewGroup) findViewById(R.id.goods_detail_buy_specinfos);
        int i2 = 0;
        int i3 = 0;
        while (true) {
            ViewGroup viewGroup2 = null;
            if (i3 >= this.M.size()) {
                break;
            }
            JSONObject jSONObject3 = this.M.get(i3);
            try {
                View inflate2 = this.f9199u.inflate(R.layout.fragment_goods_detail_buy_specs, (ViewGroup) null);
                ((TextView) inflate2.findViewById(R.id.goods_detai_buy_specs_title)).setText(jSONObject3.optString("spec_name"));
                FlowRadioGroup flowRadioGroup = (FlowRadioGroup) inflate2.findViewById(R.id.goods_detai_buy_specs_container);
                JSONArray optJSONArray = jSONObject3.optJSONArray("spec_values");
                if (!TextUtils.equals(jSONObject3.optString("spec_type"), "image")) {
                    if (optJSONArray != null) {
                        try {
                            if (optJSONArray.length() > 0) {
                                int length = optJSONArray.length();
                                for (int i4 = 0; i4 < length; i4++) {
                                    RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(-2, -2);
                                    layoutParams.rightMargin = 30;
                                    layoutParams.bottomMargin = 30;
                                    JSONObject jSONObject4 = optJSONArray.getJSONObject(i4);
                                    RadioButton radioButton = new RadioButton(this.mActivity, null, R.attr.goodsDetailBuySpecTextStyle);
                                    radioButton.setLayoutParams(layoutParams);
                                    radioButton.setPadding(40, 20, 40, 20);
                                    radioButton.setText(jSONObject4.optString("spec_value"));
                                    radioButton.setOnClickListener(this.f9179al);
                                    radioButton.setTag(R.id.tag_spec_jsonobject, jSONObject4);
                                    radioButton.setTag(R.id.tag_spec_id, jSONObject3.optString("spec_id"));
                                    radioButton.setTag(R.id.confirm_alias, jSONObject3.optString("confirm_alias"));
                                    flowRadioGroup.addView(radioButton);
                                }
                                i2 = 0;
                                try {
                                    this.f9179al.onClick(flowRadioGroup.getChildAt(0));
                                    viewGroup.addView(inflate2);
                                    view = new View(this.mActivity);
                                    view.setBackgroundResource(R.color.goods_detail_secondary_textcolor);
                                    z2 = true;
                                } catch (Exception e2) {
                                    e = e2;
                                    z2 = true;
                                    exc = e;
                                    exc.printStackTrace();
                                    i3++;
                                    z3 = z2;
                                }
                                try {
                                    view.setLayoutParams(new ViewGroup.LayoutParams(-1, 1));
                                    viewGroup.addView(view);
                                } catch (Exception e3) {
                                    e = e3;
                                    exc = e;
                                    exc.printStackTrace();
                                    i3++;
                                    z3 = z2;
                                }
                            }
                        } catch (Exception e4) {
                            e = e4;
                            i2 = 0;
                        }
                    }
                    i2 = 0;
                    z2 = true;
                } else if (optJSONArray == null || optJSONArray.length() <= 0) {
                    z2 = z3;
                } else {
                    int length2 = optJSONArray.length();
                    int i5 = i2;
                    while (i5 < length2) {
                        try {
                            jSONObject2 = optJSONArray.getJSONObject(i5);
                            inflate = this.f9199u.inflate(R.layout.item_specs_group, viewGroup2);
                            linearLayout = (LinearLayout) inflate.findViewById(R.id.ll_container);
                            linearLayout.setPadding(i2, i2, 10, i2);
                            circleImageView = (CircleImageView) inflate.findViewById(R.id.goods_detail_buy_specs);
                        } catch (Exception e5) {
                            exc = e5;
                        }
                        try {
                            circleImageView.setBorderColor(this.mActivity.getResources().getColor(R.color.red));
                            bo.c.a(jSONObject2.optString("spec_goods_images"), circleImageView);
                            ((TextView) inflate.findViewById(R.id.tv_color_name)).setText(jSONObject2.optString("spec_value"));
                            linearLayout.setOnClickListener(this.f9179al);
                            linearLayout.setTag(R.id.tag_spec_jsonobject, jSONObject2);
                            linearLayout.setId(i5);
                            linearLayout.setTag(R.id.tag_spec_id, jSONObject3.optString("spec_id"));
                            flowRadioGroup.addView(inflate);
                            if (i5 == 0) {
                                this.f9179al.onClick(linearLayout);
                            }
                            i5++;
                            i2 = 0;
                            viewGroup2 = null;
                        } catch (Exception e6) {
                            exc = e6;
                            i2 = 0;
                            z2 = true;
                            exc.printStackTrace();
                            i3++;
                            z3 = z2;
                        }
                    }
                    viewGroup.addView(inflate2);
                    View view2 = new View(this.mActivity);
                    view2.setBackgroundResource(R.color.goods_detail_secondary_textcolor);
                    try {
                        view2.setLayoutParams(new ViewGroup.LayoutParams(-1, 1));
                        viewGroup.addView(view2);
                        i2 = 0;
                        z2 = true;
                    } catch (Exception e7) {
                        exc = e7;
                        z2 = true;
                        i2 = 0;
                        exc.printStackTrace();
                        i3++;
                        z3 = z2;
                    }
                }
            } catch (Exception e8) {
                e = e8;
                z2 = z3;
            }
            i3++;
            z3 = z2;
        }
        View inflate3 = this.f9199u.inflate(R.layout.weeks_choose_layout, (ViewGroup) null);
        this.W = (GridView) inflate3.findViewById(R.id.week_gv);
        this.f9175ah = new i();
        this.W.setAdapter((ListAdapter) this.f9175ah);
        if (g()) {
            viewGroup.addView(inflate3);
        }
        if (this.P.size() > 0) {
            View inflate4 = this.f9199u.inflate(R.layout.fragment_goods_detail_buy_specs, (ViewGroup) null);
            ((TextView) inflate4.findViewById(R.id.goods_detai_buy_specs_title)).setText(this.mActivity.getString(R.string.spec_time));
            FlowRadioGroup flowRadioGroup2 = (FlowRadioGroup) inflate4.findViewById(R.id.goods_detai_buy_specs_container);
            View.OnClickListener kVar = new k();
            while (i2 < this.P.size()) {
                RadioGroup.LayoutParams layoutParams2 = new RadioGroup.LayoutParams(-2, -2);
                layoutParams2.rightMargin = 30;
                layoutParams2.bottomMargin = 30;
                RadioButton radioButton2 = new RadioButton(this.mActivity, null, R.attr.goodsDetailBuySpecTextStyle);
                radioButton2.setId(i2);
                radioButton2.setLayoutParams(layoutParams2);
                radioButton2.setPadding(40, 20, 40, 20);
                radioButton2.setText(this.P.get(i2));
                radioButton2.setOnClickListener(kVar);
                radioButton2.setTag(Integer.valueOf(i2));
                radioButton2.setTag(R.id.tag_spec_jsonobject, this.P.get(i2));
                flowRadioGroup2.addView(radioButton2);
                if (this.T == this.Q.get(this.P.get(i2)).intValue()) {
                    kVar.onClick(radioButton2);
                }
                i2++;
            }
            viewGroup.addView(inflate4);
        }
        viewGroup.addView(this.f9204z);
        View view3 = new View(this.mActivity);
        view3.setBackgroundResource(R.color.goods_line_color);
        view3.setLayoutParams(new ViewGroup.LayoutParams(-1, com.shopex.westore.k.a((Context) this.mActivity, 5.0f)));
        viewGroup.addView(view3);
    }

    public boolean g() {
        Iterator<JSONObject> it = this.M.iterator();
        boolean z2 = false;
        while (it.hasNext()) {
            if (it.next().optString("confirm_alias").contains("配送频次")) {
                z2 = true;
            }
        }
        return z2;
    }

    public void c(JSONObject jSONObject) {
        String string = getString(R.string.tao_can_hui_yuan_jia, jSONObject.optString(com.shopex.westore.k.L));
        if ("1".equals(this.f9168aa) && "1".equals(this.f9169ab)) {
            gp.d dVar = this.f9177aj;
            TextView textView = this.f9177aj.f19190d;
            Object[] objArr = new Object[2];
            objArr[0] = jSONObject.optString("price");
            if (TextUtils.isEmpty(string)) {
                string = "";
            }
            objArr[1] = string;
            dVar.a(textView, com.shopex.westore.k.a(objArr));
        } else {
            this.f9177aj.a(this.f9177aj.f19190d, com.shopex.westore.k.a(jSONObject.optString("price")));
        }
        ((TextView) findViewById(R.id.goods_detail_buy_stock)).setText(this.mActivity.getString(R.string.goods_detail_buy_stock, new Object[]{jSONObject.optString("quantity")}));
        this.f9195q = jSONObject;
    }

    public class k implements View.OnClickListener {
        k() {
        }

        @Override
        public void onClick(View view) {
            if (view instanceof RadioButton) {
                ((RadioButton) view).setChecked(true);
            }
            if (view.getTag(R.id.tag_spec_jsonobject) == null) {
                return;
            }
            aq.this.T = ((Integer) aq.this.Q.get((String) view.getTag(R.id.tag_spec_jsonobject))).intValue();
        }
    }

    private void d(JSONObject jSONObject) {
        int i2;
        int i3;
        this.f9168aa = jSONObject.optString("is_package");
        this.f9169ab = jSONObject.optString("package_member");
        this.f9170ac = jSONObject.optString("discount");
        this.f9177aj.f19194h.setText(jSONObject.optString("brief"));
        this.f9177aj.f19193g.setNumColumns(2);
        this.f9177aj.f19193g.setAdapter((ListAdapter) new m(jSONObject.optJSONObject("tip").optJSONArray("tip_text")));
        this.f9177aj.f19192f.setVisibility("subscribe".equals(jSONObject.optString("feature")) ? 8 : 0);
        findViewById(R.id.goods_detail_add_shoppingcart_ll).setVisibility("subscribe".equals(jSONObject.optString("feature")) ? 4 : 0);
        this.f9204z.setVisibility("subscribe".equals(jSONObject.optString("feature")) ? 8 : 0);
        if (jSONObject.optJSONObject("brand") != null) {
            ((TextView) findViewById(R.id.detail_brand_name)).setText("品牌:" + jSONObject.optJSONObject("brand").optString("brand_name"));
            findViewById(R.id.rel_brand_view).setTag(jSONObject.optJSONObject("brand"));
            bo.c.a(jSONObject.optJSONObject("brand").optString("logo_src"), (ImageView) findViewById(R.id.img_brand_logo));
        } else {
            ((TextView) findViewById(R.id.detail_brand_name)).setText("品牌:未知");
        }
        if (this.f9186h == 1) {
            this.mHandler.sendEmptyMessage(0);
            JSONObject jSONObject2 = this.F;
            View findViewById = findViewById(R.id.goods_detail_title);
            LinearLayout linearLayout = (LinearLayout) findViewById.getParent();
            linearLayout.removeView(findViewById);
            linearLayout.addView(findViewById, 1);
            ((TextView) findViewById(R.id.goods_detail_oldprice)).setText(com.shopex.westore.k.a("¥", jSONObject2.optString("old_price")));
            this.f9177aj.a(this.f9177aj.f19190d, jSONObject2.optString("price"));
        } else {
            String str = "";
            if (this.G != null) {
                this.f9202x = this.G.optInt("buy_limit");
                if (this.f9202x > 0) {
                    ((TextView) this.rootView.findViewById(R.id.goods_detail_limit_quantity)).setText(this.mActivity.getString(R.string.activity_limit_quantity, new Object[]{1}));
                }
                str = this.G.optString("price");
            }
            JSONArray optJSONArray = jSONObject.optJSONArray("skus");
            if (optJSONArray != null && optJSONArray.length() > 0) {
                JSONObject optJSONObject = optJSONArray.optJSONObject(0);
                if (optJSONObject.optBoolean("is_starbuy", false)) {
                    JSONObject optJSONObject2 = optJSONObject.optJSONObject("starbuy_info");
                    findViewById(R.id.goods_detail_layout).setVisibility(0);
                    if (optJSONObject2 != null) {
                        str = optJSONObject2.optString("promotion_price");
                    }
                    long optLong = optJSONObject2.optLong(dq.X) - jSONObject.optLong("system_time");
                    long optLong2 = jSONObject.optLong("system_time");
                    int i4 = (int) optLong;
                    if (i4 > 60) {
                        i2 = i4 / 60;
                        i4 %= 60;
                    } else {
                        i2 = 0;
                    }
                    if (optLong2 > 60) {
                        i3 = i2 / 60;
                        i2 %= 60;
                    } else {
                        i3 = 0;
                    }
                    ((RushBuyCountDownTimerView) findViewById(R.id.goods_detail_time)).a(i3, i2, i4);
                    ((RushBuyCountDownTimerView) findViewById(R.id.goods_detail_time)).a();
                    ((TextView) findViewById(R.id.goods_detail_oldprice)).setText(com.shopex.westore.k.a("¥", jSONObject.optString("market_price")));
                }
                if (TextUtils.isEmpty(str)) {
                    str = jSONObject.optString("price");
                }
                this.f9177aj.a(this.f9177aj.f19190d, str);
            }
        }
        this.f9177aj.f19189c.setText(jSONObject.optString(dc.c.J));
        this.f9177aj.a(jSONObject.optString("subtitle"));
        int color = this.f9189k.getColor(R.color.westore_dark_textcolor);
        String optString = jSONObject.optString("buy_count");
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(optString);
        spannableStringBuilder.setSpan(new ForegroundColorSpan(color), 0, optString.length(), 33);
        spannableStringBuilder.insert(0, (CharSequence) this.mActivity.getString(R.string.total_sales));
        spannableStringBuilder.append((CharSequence) this.mActivity.getString(R.string.total_sales_unit));
        ((TextView) findViewById(R.id.goods_detail_total_sales)).setText(spannableStringBuilder);
        String optString2 = jSONObject.optString("comments_count");
        SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder(optString2);
        spannableStringBuilder2.setSpan(new ForegroundColorSpan(color), 0, optString2.length(), 33);
        spannableStringBuilder2.insert(0, (CharSequence) this.mActivity.getString(R.string.total_rates));
        spannableStringBuilder2.append((CharSequence) this.mActivity.getString(R.string.total_rates_unit));
        ((TextView) findViewById(R.id.goods_detail_total_rate)).setText(spannableStringBuilder2);
        ((TextView) findViewById(R.id.goods_detail_oldprice)).getPaint().setFlags(16);
        this.f9196r.setText(String.valueOf(this.f9193o));
        JSONArray jSONArray = null;
        try {
            jSONArray = new JSONArray(jSONObject.optString("item_imgs"));
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        if (jSONArray != null && jSONArray.length() > 0) {
            int length = jSONArray.length();
            ArrayList arrayList = new ArrayList();
            for (int i5 = 0; i5 < length; i5++) {
                arrayList.add(jSONArray.optJSONObject(i5).optString("big_url"));
            }
            this.f9177aj.a(arrayList);
            for (int i6 = 0; i6 < length; i6++) {
                this.O.add(jSONArray.optJSONObject(i6));
            }
        }
        showCancelableLoadingDialog();
        this.f9177aj.a(this.E);
    }

    public void e(JSONObject jSONObject) {
        try {
            JSONArray jSONArray = jSONObject.getJSONArray("data");
            if (jSONArray != null && jSONArray.length() > 0) {
                c cVar = new c(jSONArray);
                for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                    this.C.addView(cVar.getView(i2, null, null));
                }
                return;
            }
            findViewById(R.id.good_detail_recommend_title).setVisibility(4);
        } catch (Exception e2) {
            e2.printStackTrace();
            findViewById(R.id.good_detail_recommend_title).setVisibility(4);
        }
    }

    public class c extends BaseAdapter implements View.OnClickListener {
        private JSONArray f9225b;

        @Override
        public Object getItem(int i2) {
            return null;
        }

        @Override
        public long getItemId(int i2) {
            return 0L;
        }

        public c(JSONArray jSONArray) {
            this.f9225b = jSONArray;
        }

        @Override
        public int getCount() {
            if (this.f9225b == null) {
                return 0;
            }
            return this.f9225b.length();
        }

        @Override
        public View getView(int i2, View view, ViewGroup viewGroup) {
            if (view == null) {
                view = aq.this.f9199u.inflate(R.layout.fragment_detail_recomend_item, (ViewGroup) null);
            }
            JSONObject optJSONObject = this.f9225b.optJSONObject(i2);
            bo.c.a(optJSONObject.optString("image_default"), (ImageView) view.findViewById(R.id.item_recomend_img1));
            ((TextView) view.findViewById(R.id.item_recomend_title)).setText(optJSONObject.optString(ca.c.f4824e));
            ((TextView) view.findViewById(R.id.item_recomend_price1)).setText("¥" + optJSONObject.optString("price"));
            view.setTag(optJSONObject);
            view.setOnClickListener(this);
            return view;
        }

        @Override
        public void onClick(View view) {
            if (view.getTag() != null) {
                aq.this.startActivity(AgentActivity.a(aq.this.mActivity, (int) AgentActivity.f8623g).putExtra(com.shopex.westore.k.f10237i, ((JSONObject) view.getTag()).optString("goods_id")));
            }
        }
    }

    public class m extends BaseAdapter {
        private JSONArray f9246b;

        @Override
        public Object getItem(int i2) {
            return null;
        }

        @Override
        public long getItemId(int i2) {
            return 0L;
        }

        public m(JSONArray jSONArray) {
            this.f9246b = jSONArray;
        }

        @Override
        public int getCount() {
            if (this.f9246b == null) {
                return 0;
            }
            return this.f9246b.length();
        }

        @Override
        public View getView(int i2, View view, ViewGroup viewGroup) {
            View inflate = aq.this.f9199u.inflate(R.layout.item_shopping_tip, (ViewGroup) null);
            TextView textView = (TextView) inflate.findViewById(R.id.tv_tip_name);
            ImageView imageView = (ImageView) inflate.findViewById(R.id.iv_tip_image);
            try {
                textView.setText("null".equals(this.f9246b.getString(i2)) ? "" : this.f9246b.getString(i2));
                imageView.setVisibility("null".equals(this.f9246b.getString(i2)) ? 8 : 0);
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
            return inflate;
        }
    }

    public class j implements fu.e {
        private String f9240b;
        private int f9241c;

        public j(String str, int i2) {
            this.f9240b = str;
            this.f9241c = i2;
        }

        @Override
        public fu.c task_request() {
            aq.this.showCancelableLoadingDialog();
            return new fu.c("groupactivity.index.buy").a("product_id", this.f9240b).a("num", String.valueOf(this.f9241c));
        }

        @Override
        public void task_response(String str) {
            aq.this.hideLoadingDialog_mt();
            try {
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, new JSONObject(str))) {
                    aq.this.onClick(aq.this.findViewById(R.id.goods_detail_buy_cancel));
                    com.shopex.westore.k.a(new fu.d(), new n("group"));
                }
            } catch (Exception unused) {
            }
        }
    }

    public class l implements fu.e {
        private String f9244b;

        public l(String str) {
            this.f9244b = str;
        }

        @Override
        public void task_response(String str) {
            aq.this.hideLoadingDialog_mt();
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject.optString("data"));
                    aq.this.f9183e = false;
                    aq.this.f9177aj.f19188b.setImageResource(R.drawable.goods_collection_ordinary);
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }

        @Override
        public fu.c task_request() {
            aq.this.showCancelableLoadingDialog();
            fu.c cVar = new fu.c("mobileapi.member.del_fav");
            cVar.a("gid", this.f9244b);
            return cVar;
        }
    }

    public class a implements fu.e {
        private c.a f9216b;
        private DoActivity f9217c;
        private String f9218d;
        private int f9219e;
        private int f9220f;
        private String f9221g;

        public a(DoActivity doActivity, c.a aVar, String str, int i2, String str2, int i3) {
            this.f9216b = aVar;
            this.f9217c = doActivity;
            this.f9218d = str;
            this.f9219e = i2;
            this.f9221g = str2;
            this.f9220f = i3;
        }

        @Override
        public fu.c task_request() {
            fu.c a2;
            this.f9217c.f();
            if (this.f9220f == 0) {
                a2 = new fu.c("mobileapi.cart.add").a("product_id", this.f9218d).a("num", String.valueOf(this.f9219e));
            } else {
                a2 = new fu.c("mobileapi.cart.add").a("product_id", this.f9218d).a("num", String.valueOf(this.f9219e)).a("spec_time", String.valueOf(this.f9220f));
            }
            if (!TextUtils.isEmpty(this.f9221g)) {
                a2.a("btype", this.f9221g);
            }
            return a2;
        }

        @Override
        public void task_response(String str) {
            this.f9217c.h();
            try {
                if (!com.shopex.westore.k.a((Context) this.f9217c, new JSONObject(str)) || this.f9216b == null) {
                    return;
                }
                this.f9216b.task_response(str);
            } catch (Exception unused) {
            }
        }
    }

    public class b implements fu.e {
        private String f9223b;

        public b(String str) {
            this.f9223b = str;
        }

        @Override
        public fu.c task_request() {
            aq.this.showCancelableLoadingDialog();
            return new fu.c("mobileapi.member.add_fav").a("gid", this.f9223b);
        }

        @Override
        public void task_response(String str) {
            aq.this.hideLoadingDialog_mt();
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject.optString("data"));
                    aq.this.f9183e = true;
                    aq.this.f9177aj.f19188b.setImageResource(R.drawable.goods_collection_select);
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    private class d implements fu.e {
        private d() {
        }

        @Override
        public void task_response(String str) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    com.shopex.westore.k.f10233e = jSONObject.optJSONObject("data").optInt("goods_subtotal");
                    aq.this.f9197s.setVisibility(com.shopex.westore.k.f10233e > 0 ? 0 : 4);
                    aq.this.f9197s.setText(String.valueOf(com.shopex.westore.k.f10233e));
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }

        @Override
        public fu.c task_request() {
            return new fu.c("mobileapi.cart.get_list_group_by_tip");
        }
    }

    private class n implements fu.e {
        private String f9248b;

        public n() {
            this.f9248b = "true";
        }

        public n(String str) {
            this.f9248b = "true";
            this.f9248b = str;
        }

        @Override
        public fu.c task_request() {
            aq.this.showCancelableLoadingDialog();
            return new fu.c("mobileapi.cart.checkout").a("isfastbuy", this.f9248b);
        }

        @Override
        public void task_response(String str) {
            aq.this.hideLoadingDialog_mt();
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (!com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject) || jSONObject.isNull("data")) {
                    return;
                }
                JSONObject optJSONObject = jSONObject.optJSONObject("data");
                String jSONArray = optJSONObject.optJSONArray("coupon_lists") != null ? optJSONObject.optJSONArray("coupon_lists").toString() : "";
                if (aq.this.H != null) {
                    aq.this.startActivity(AgentActivity.a(aq.this.mActivity, (int) AgentActivity.f8639w).putExtra("com.shopex.westore.EXTRA_DATA", optJSONObject.toString()).putExtra(com.shopex.westore.k.f10241m, this.f9248b).putExtra(com.shopex.westore.k.f10248t, aq.this.H.toString()).putExtra(com.shopex.westore.k.f10249u, jSONArray));
                } else {
                    aq.this.startActivityForResult(AgentActivity.a(aq.this.mActivity, (int) AgentActivity.f8639w).putExtra("com.shopex.westore.EXTRA_DATA", optJSONObject.toString()).putExtra(com.shopex.westore.k.f10241m, this.f9248b).putExtra(com.shopex.westore.k.f10249u, jSONArray).putExtra(com.shopex.westore.k.G, aq.this.f9168aa), 1);
                }
            } catch (Exception unused) {
            }
        }
    }

    @Override
    public void onActivityResult(int i2, int i3, Intent intent) {
        super.onActivityResult(i2, i3, intent);
        if (i3 == -1 && "1".equals(this.f9168aa) && intent.getBooleanExtra("paystate", false)) {
            Intent intent2 = new Intent(getActivity(), MainTabFragmentActivity.class);
            intent2.putExtra(com.shopex.westore.k.f10236h, 4);
            intent2.setFlags(67108864);
            startActivity(intent2);
        }
    }

    public class g implements fu.e {
        private String f9230b;

        public g(String str) {
            this.f9230b = str;
        }

        @Override
        public void task_response(String str) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    aq.this.e(jSONObject);
                } else {
                    aq.this.findViewById(R.id.good_detail_recommend_title).setVisibility(8);
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }

        @Override
        public fu.c task_request() {
            fu.c cVar = new fu.c("mobileapi.goods.goodslink");
            cVar.a("iid", this.f9230b);
            return cVar;
        }
    }

    private class h implements fu.e {
        private int f9232b;
        private boolean f9233c;

        public h(int i2) {
            this.f9232b = 0;
            this.f9233c = true;
            this.f9232b = i2;
        }

        public h(int i2, boolean z2) {
            this.f9232b = 0;
            this.f9233c = true;
            this.f9232b = i2;
            this.f9233c = z2;
        }

        @Override
        public fu.c task_request() {
            if (this.f9233c) {
                aq.this.showCancelableLoadingDialog();
            }
            if (this.f9232b == 1) {
                return new fu.c("groupactivity.index.get_detail").a("act_id", aq.this.f9192n);
            }
            return new fu.c("mobileapi.goods.get_item").a("iid", aq.this.f9190l).a("son_object", "json").a("brand_detail", "1");
        }

        @Override
        public void task_response(String str) {
            aq.this.hideLoadingDialog_mt();
            aq.this.rootView.setVisibility(0);
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    JSONObject optJSONObject = jSONObject.optJSONObject("data");
                    if (this.f9232b == 1) {
                        if (optJSONObject != null && !optJSONObject.isNull("data")) {
                            aq.this.F = optJSONObject.optJSONObject("data");
                            com.shopex.westore.k.a(new fu.d(), new h(0));
                        }
                    } else if (optJSONObject != null && !optJSONObject.isNull("item")) {
                        aq.this.a(optJSONObject.optJSONObject("item"));
                    }
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    private class f implements fu.e {
        private f() {
        }

        @Override
        public void task_response(String str) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    aq.this.hideLoadingDialog_mt();
                    aq.this.rootView.setVisibility(0);
                    JSONObject optJSONObject = jSONObject.optJSONObject("data");
                    if (optJSONObject != null) {
                        if (!optJSONObject.isNull("from_extract")) {
                            aq.this.H = optJSONObject.optJSONArray("from_extract");
                        }
                        if (!optJSONObject.isNull("info")) {
                            aq.this.G = optJSONObject.optJSONObject("info");
                        }
                        if (optJSONObject.isNull("goods")) {
                            return;
                        }
                        aq.this.a(optJSONObject.optJSONObject("goods"));
                        return;
                    }
                    return;
                }
                aq.this.findViewById(R.id.goods_detail_shoppingcar).setVisibility(0);
                aq.this.findViewById(R.id.goods_detail_addto_shopcar).setVisibility(0);
                com.shopex.westore.k.a(new fu.d(), new h(aq.this.f9186h, false));
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }

        @Override
        public fu.c task_request() {
            aq.this.showCancelableLoadingDialog();
            fu.c cVar = new fu.c("starbuy.index.getDetail");
            cVar.a("product_id", aq.this.f9191m);
            cVar.a("son_object", "json");
            return cVar;
        }
    }

    private class e implements fu.e {
        private e() {
        }

        @Override
        public void task_response(String str) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (com.shopex.westore.k.a((Context) aq.this.mActivity, jSONObject)) {
                    aq.this.f9190l = jSONObject.optString("data");
                    com.shopex.westore.k.a(new fu.d(), new h(aq.this.f9186h));
                    aq.this.findViewById(R.id.goods_detail_shoppingcar).setVisibility(0);
                    aq.this.findViewById(R.id.goods_detail_addto_shopcar).setVisibility(0);
                }
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }

        @Override
        public fu.c task_request() {
            fu.c cVar = new fu.c("mobileapi.goods.get_gid");
            cVar.a("pid", aq.this.f9187i);
            return cVar;
        }
    }

    @Override
    public String b() {
        String c2 = c();
        if (TextUtils.isEmpty(c2)) {
            return null;
        }
        return com.shopex.westore.util.b.b(c2);
    }

    @Override
    public String c() {
        if (this.O.isEmpty()) {
            return null;
        }
        return this.O.get(0).optString("big_url");
    }

    @Override
    public String a() {
        if (this.E != null) {
            return this.E.optString(dc.c.J) + "-" + this.E.optString("brief");
        }
        return null;
    }

    @Override
    public String d() {
        return "https://www.zjsjtz.com/wap/product-" + this.f9190l + ".html";
    }
}