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

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


package fo;

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 f16986a;
    private LayoutInflater f16987b;
    private BaseAdapter f16988c;
    private com.shopex.westore.h f16989d;
    private ArrayList<JSONObject> f16990e = new ArrayList<>();
    private ArrayList<JSONObject> f16991f = new ArrayList<>();

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

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

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

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

        private e() {
            this.f17005b = 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.f16990e.size() / 2.0d);
        }

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

        @Override
        public View getView(int i2, View view, ViewGroup viewGroup) {
            if (view == null) {
                view = aj.this.f16987b.inflate(R.layout.fragment_personal_list_item, (ViewGroup) null);
                int length = this.f17005b.length;
                for (int i3 = 0; i3 < length; i3++) {
                    View findViewById = view.findViewById(this.f17005b[i3]);
                    findViewById.findViewById(R.id.account_click_but).setOnClickListener(this);
                    findViewById.setOnClickListener(this);
                }
            }
            int length2 = this.f17005b.length;
            for (int i4 = 0; i4 < length2; i4++) {
                JSONObject item = getItem((i2 * length2) + i4);
                View findViewById2 = view.findViewById(this.f17005b[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.f4824e));
                    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 fu.d(), new b(jSONObject));
                        return;
                    } else {
                        com.shopex.westore.k.a(new fu.d(), new a(jSONObject));
                        return;
                    }
                }
                aj.this.startActivity(AgentActivity.a(aj.this.mActivity, (int) AgentActivity.f8565ay).putExtra("userId", jSONObject.optString("member_id")));
            }
        }
    }

    private class c implements fu.e {
        private String f17001b;
        private String f17002c;

        public c(String str, String str2) {
            this.f17001b = str;
            this.f17002c = str2;
        }

        @Override
        public void task_response(String str) {
            fu.d dVar;
            fu.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.f4824e, optJSONArray.optJSONObject(i2).optString("screen_name"));
                            aj.this.f16991f.add(jSONObject2);
                        }
                    }
                } catch (JSONException e2) {
                    e2.printStackTrace();
                    if (aj.this.f16991f.size() <= 0) {
                        return;
                    }
                    dVar = new fu.d();
                    eVarArr = new fu.e[]{new d()};
                }
                if (aj.this.f16991f.size() > 0) {
                    dVar = new fu.d();
                    eVarArr = new fu.e[]{new d()};
                    dVar.execute(eVarArr);
                }
            } catch (Throwable th) {
                if (aj.this.f16991f.size() > 0) {
                    new fu.d().execute(new d());
                }
                throw th;
            }
        }

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

    private class d implements fu.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.f16990e.add(optJSONArray.optJSONObject(i2));
                        }
                    }
                } catch (JSONException e2) {
                    e2.printStackTrace();
                }
            } finally {
                aj.this.f16988c.notifyDataSetChanged();
            }
        }

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

    private class b implements fu.e {
        private String f16997b;
        private String f16998c;
        private JSONObject f16999d;

        public b(String str, String str2) {
            this.f16997b = str;
            this.f16998c = str2;
        }

        public b(JSONObject jSONObject) {
            this.f16999d = jSONObject;
            this.f16997b = this.f16999d.optString("member_id");
            this.f16998c = aj.this.f16989d.K();
        }

        @Override
        public fu.c task_request() {
            aj.this.showCancelableLoadingDialog();
            fu.c cVar = new fu.c("mobileapi.member.un_attention");
            cVar.a("member_id", this.f16997b);
            cVar.a("fans_id", this.f16998c);
            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.f16990e.indexOf(this.f16999d);
                    this.f16999d.put("is_attention", 0);
                    aj.this.f16990e.set(indexOf, this.f16999d);
                    aj.this.f16988c.notifyDataSetChanged();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    private class a implements fu.e {
        private String f16993b;
        private String f16994c;
        private JSONObject f16995d;

        public a(String str, String str2) {
            this.f16993b = str;
            this.f16994c = str2;
        }

        public a(JSONObject jSONObject) {
            this.f16995d = jSONObject;
            this.f16993b = this.f16995d.optString("member_id");
            this.f16994c = aj.this.f16989d.K();
        }

        @Override
        public fu.c task_request() {
            aj.this.showCancelableLoadingDialog();
            fu.c cVar = new fu.c("mobileapi.member.attention");
            cVar.a("member_id", this.f16993b);
            cVar.a("fans_id", this.f16994c);
            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.f16990e.indexOf(this.f16995d);
                    this.f16995d.put("is_attention", 1);
                    aj.this.f16990e.set(indexOf, this.f16995d);
                    aj.this.f16988c.notifyDataSetChanged();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}