中建乐购 v3.2.2版本的 MD5 值为:0553721e6bc6ba8dd67004696a555b81

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


package fd;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.shopex.westore.AgentApplication;
import com.shopex.westore.activity.AgentActivity;
import com.zjsjtz.ecstore.R;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class aj extends com.shopex.westore.b {
    private ListView f16763a;
    private LayoutInflater f16764b;
    private BaseAdapter f16765c;
    private com.shopex.westore.h f16766d;
    private ArrayList<JSONObject> f16767e = new ArrayList<>();
    private ArrayList<JSONObject> f16768f = new ArrayList<>();

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.mActionBar.setTitle("微博好友");
        this.f16766d = AgentApplication.c(this.mActivity);
    }

    @Override
    public void init(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        super.init(layoutInflater, viewGroup, bundle);
        this.f16764b = layoutInflater;
        this.f16763a = new ListView(this.mActivity);
        this.f16763a.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        this.f16763a.setDivider(null);
        this.rootView = this.f16763a;
        this.f16765c = new e();
        this.f16763a.setAdapter((ListAdapter) this.f16765c);
        String a2 = com.shopex.westore.k.a((Context) this.mActivity, o.f17504b, "");
        if (TextUtils.isEmpty(a2)) {
            return;
        }
        String[] split = a2.split(bl.d.f4534d);
        new fj.d().execute(new c(split[0], split[1]));
    }

    private class e extends BaseAdapter implements View.OnClickListener {
        private final int[] f16782b;

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

        private e() {
            this.f16782b = new int[]{R.id.account_personal_list_item_one, R.id.account_personal_list_item_two};
        }

        @Override
        public int getCount() {
            return (int) Math.ceil(aj.this.f16767e.size() / 2.0d);
        }

        @Override
        public JSONObject getItem(int i2) {
            if (i2 >= aj.this.f16767e.size()) {
                return null;
            }
            return (JSONObject) aj.this.f16767e.get(i2);
        }

        @Override
        public View getView(int i2, View view, ViewGroup viewGroup) {
            if (view == null) {
                view = aj.this.f16764b.inflate(R.layout.fragment_personal_list_item, (ViewGroup) null);
                int length = this.f16782b.length;
                for (int i3 = 0; i3 < length; i3++) {
                    View findViewById = view.findViewById(this.f16782b[i3]);
                    findViewById.findViewById(R.id.account_click_but).setOnClickListener(this);
                    findViewById.setOnClickListener(this);
                }
            }
            int length2 = this.f16782b.length;
            for (int i4 = 0; i4 < length2; i4++) {
                JSONObject item = getItem((i2 * length2) + i4);
                View findViewById2 = view.findViewById(this.f16782b[i4]);
                findViewById2.findViewById(R.id.account_user_linear).setVisibility(8);
                if (item != null) {
                    ((TextView) findViewById2.findViewById(R.id.account_user_name)).setText(item.optString(ca.c.f4821e));
                    if (item.optInt("is_attention") == 1) {
                        ((TextView) findViewById2.findViewById(R.id.account_click_but)).setText("已关注");
                    } else {
                        ((TextView) findViewById2.findViewById(R.id.account_click_but)).setText("+关注");
                    }
                    findViewById2.findViewById(R.id.account_click_but).setTag(item);
                    bo.c.a(item.optString("avatar"), (ImageView) findViewById2.findViewById(R.id.attention_item_avd));
                    findViewById2.setTag(item);
                    findViewById2.setVisibility(0);
                } else {
                    findViewById2.setVisibility(4);
                }
            }
            return view;
        }

        @Override
        public void onClick(View view) {
            if (view.getTag() != null) {
                JSONObject jSONObject = (JSONObject) view.getTag();
                if (view.getId() == R.id.account_click_but) {
                    if (jSONObject.optInt("is_attention") == 1) {
                        com.shopex.westore.k.a(new fj.d(), new b(jSONObject));
                        return;
                    } else {
                        com.shopex.westore.k.a(new fj.d(), new a(jSONObject));
                        return;
                    }
                }
                aj.this.startActivity(AgentActivity.a(aj.this.mActivity, (int) AgentActivity.f8519ay).putExtra("userId", jSONObject.optString("member_id")));
            }
        }
    }

    private class c implements fj.e {
        private String f16778b;
        private String f16779c;

        public c(String str, String str2) {
            this.f16778b = str;
            this.f16779c = str2;
        }

        @Override
        public void task_response(String str) {
            fj.d dVar;
            fj.e[] eVarArr;
            try {
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    if (jSONObject != null) {
                        JSONArray optJSONArray = jSONObject.optJSONArray("users");
                        int length = optJSONArray == null ? 0 : optJSONArray.length();
                        for (int i2 = 0; i2 < length; i2++) {
                            JSONObject jSONObject2 = new JSONObject();
                            jSONObject2.put("uid", optJSONArray.optJSONObject(i2).optString("id"));
                            jSONObject2.put(ca.c.f4821e, optJSONArray.optJSONObject(i2).optString("screen_name"));
                            aj.this.f16768f.add(jSONObject2);
                        }
                    }
                } catch (JSONException e2) {
                    e2.printStackTrace();
                    if (aj.this.f16768f.size() <= 0) {
                        return;
                    }
                    dVar = new fj.d();
                    eVarArr = new fj.e[]{new d()};
                }
                if (aj.this.f16768f.size() > 0) {
                    dVar = new fj.d();
                    eVarArr = new fj.e[]{new d()};
                    dVar.execute(eVarArr);
                }
            } catch (Throwable th) {
                if (aj.this.f16768f.size() > 0) {
                    new fj.d().execute(new d());
                }
                throw th;
            }
        }

        @Override
        public fj.c task_request() {
            fj.c cVar = new fj.c("https://api.weibo.com/2/friendships/friends.json?");
            cVar.a("uid", this.f16778b);
            cVar.a("count", "200");
            cVar.a("access_token", this.f16779c);
            cVar.f18316e = "GET";
            return cVar;
        }
    }

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

        @Override
        public void task_response(String str) {
            JSONObject optJSONObject;
            JSONArray optJSONArray;
            try {
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    if (com.shopex.westore.k.a((Context) aj.this.mActivity, jSONObject) && (optJSONObject = jSONObject.optJSONObject("data")) != null && (optJSONArray = optJSONObject.optJSONArray("reg")) != null && optJSONArray.length() > 0) {
                        for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
                            aj.this.f16767e.add(optJSONArray.optJSONObject(i2));
                        }
                    }
                } catch (JSONException e2) {
                    e2.printStackTrace();
                }
            } finally {
                aj.this.f16765c.notifyDataSetChanged();
            }
        }

        @Override
        public fj.c task_request() {
            return new fj.c("mobileapi.member.weibo_list").a("weibos", aj.this.f16768f.toString());
        }
    }

    private class b implements fj.e {
        private String f16774b;
        private String f16775c;
        private JSONObject f16776d;

        public b(String str, String str2) {
            this.f16774b = str;
            this.f16775c = str2;
        }

        public b(JSONObject jSONObject) {
            this.f16776d = jSONObject;
            this.f16774b = this.f16776d.optString("member_id");
            this.f16775c = aj.this.f16766d.K();
        }

        @Override
        public fj.c task_request() {
            aj.this.showCancelableLoadingDialog();
            fj.c cVar = new fj.c("mobileapi.member.un_attention");
            cVar.a("member_id", this.f16774b);
            cVar.a("fans_id", this.f16775c);
            return cVar;
        }

        @Override
        public void task_response(String str) {
            aj.this.hideLoadingDialog_mt();
            try {
                if (com.shopex.westore.k.a((Context) aj.this.mActivity, new JSONObject(str))) {
                    int indexOf = aj.this.f16767e.indexOf(this.f16776d);
                    this.f16776d.put("is_attention", 0);
                    aj.this.f16767e.set(indexOf, this.f16776d);
                    aj.this.f16765c.notifyDataSetChanged();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    private class a implements fj.e {
        private String f16770b;
        private String f16771c;
        private JSONObject f16772d;

        public a(String str, String str2) {
            this.f16770b = str;
            this.f16771c = str2;
        }

        public a(JSONObject jSONObject) {
            this.f16772d = jSONObject;
            this.f16770b = this.f16772d.optString("member_id");
            this.f16771c = aj.this.f16766d.K();
        }

        @Override
        public fj.c task_request() {
            aj.this.showCancelableLoadingDialog();
            fj.c cVar = new fj.c("mobileapi.member.attention");
            cVar.a("member_id", this.f16770b);
            cVar.a("fans_id", this.f16771c);
            return cVar;
        }

        @Override
        public void task_response(String str) {
            aj.this.hideLoadingDialog_mt();
            try {
                if (com.shopex.westore.k.a((Context) aj.this.mActivity, new JSONObject(str))) {
                    int indexOf = aj.this.f16767e.indexOf(this.f16772d);
                    this.f16772d.put("is_attention", 1);
                    aj.this.f16767e.set(indexOf, this.f16772d);
                    aj.this.f16765c.notifyDataSetChanged();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}