和通讯录 v3.9.6版本的 MD5 值为:669178e2ee1b2311daf378bd20c6bbe1

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


package com.aspire.yellowpage.main;

import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TableLayout;
import android.widget.TextView;
import com.aspire.yellowpage.pullableview.PullToRefreshLayout;
import com.aspire.yellowpage.pullableview.PullableScrollView;
import com.aspire.yellowpage.view.AutoImageCycleView;
import com.aspire.yellowpage.view.GridCycleView;
import com.huawei.mcs.cloud.msg.base.mms.Telephony;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

public class an extends Fragment implements View.OnClickListener {

    private Context f821a;

    private View f822b;
    private LinearLayout c;
    private RelativeLayout d;
    private LinearLayout e;
    private TextView f;
    private PullableScrollView g;
    private PullToRefreshLayout h;
    private TableLayout i;
    private com.aspire.yellowpage.view.al j;
    private BroadcastReceiver k;
    private AutoImageCycleView l;
    private GridCycleView m;
    private GridCycleView n;
    private RelativeLayout o;
    private Intent s;
    private ArrayList<com.aspire.yellowpage.e.h> t;
    private ArrayList<com.aspire.yellowpage.e.h> u;
    private ArrayList<com.aspire.yellowpage.e.a> w;
    private com.aspire.yellowpage.c.a z;
    private String p = "广州";
    private String q = "广东省";
    private String r = "115";
    private ArrayList<com.aspire.yellowpage.e.b> v = new ArrayList<>();
    private int x = 2;
    private boolean y = false;
    private Handler A = new ao(this);

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f821a = getActivity();
        f();
        o();
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        this.f822b = layoutInflater.inflate(cn.asp_yp_main_layout, viewGroup, false);
        a(this.f822b);
        return this.f822b;
    }

    private void f() {
        this.z = com.aspire.yellowpage.c.a.a(this.f821a);
        this.p = this.z.b();
        b();
        a();
        h();
    }

    private void a(View view) {
        this.h = (PullToRefreshLayout) view.findViewById(cm.refresh_root);
        this.h.setOnRefreshListener(new aw(this, null));
        this.h.setEnablePullUp(false);
        this.g = (PullableScrollView) view.findViewById(cm.sv_layout);
        this.d = (RelativeLayout) view.findViewById(cm.rl_main_search_click);
        this.d.setOnClickListener(this);
        this.e = (LinearLayout) view.findViewById(cm.layout_city_press);
        this.e.setOnClickListener(this);
        this.f = (TextView) view.findViewById(cm.tv_city_name);
        this.f.setText(this.p);
        this.g.setVisibility(8);
        if (com.aspire.yellowpage.d.e.a(this.f821a).a() > 0) {
            this.v = com.aspire.yellowpage.d.b.a(this.f821a).b("0");
            this.t = com.aspire.yellowpage.d.g.a(this.f821a).a("1");
            this.u = com.aspire.yellowpage.d.g.a(this.f821a).b("near");
            b(view);
            return;
        }
        this.h.a();
        this.y = true;
    }

    public void b(View view) {
        try {
            if (this.g.getVisibility() == 8) {
                this.g.setVisibility(0);
            }
            this.l = (AutoImageCycleView) view.findViewById(cm.slideShowView_ads);
            l();
            if (this.w != null && this.w.size() > 0) {
                this.l.setImageResources(this.w);
            } else {
                this.w = new ArrayList<>();
                com.aspire.yellowpage.e.a aVar = new com.aspire.yellowpage.e.a();
                aVar.b("发现");
                aVar.a("find");
                this.w.add(0, aVar);
                this.l.setImageResources(this.w);
            }
            this.o = (RelativeLayout) view.findViewById(cm.rl_find_ads);
            this.o.setOnClickListener(this);
            this.m = (GridCycleView) view.findViewById(cm.slideShowView_svcs);
            this.m.getRootView().setBackgroundColor(Color.parseColor("#ffffff"));
            if (this.t != null && this.t.size() >= 1) {
                this.m.setDatas(a(this.t, 8));
            }
            this.n = (GridCycleView) view.findViewById(cm.slideShowView_near_svcs);
            this.n.getRootView().setBackgroundColor(Color.parseColor("#ffffff"));
            if (this.u != null && this.u.size() >= 1) {
                this.n.setDatas(a(this.u, 5));
            }
            this.c = (LinearLayout) view.findViewById(cm.ll_all_svc);
            this.c.removeAllViews();
            this.j = new com.aspire.yellowpage.view.al(this.f821a);
            this.j.c(15);
            this.j.b(Color.parseColor("#222222"));
            this.j.a(Color.parseColor("#dddddd"));
            this.i = this.j.a(this.v, this.x);
            this.c.addView(this.i);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void c(View view) {
        try {
            if (this.w != null && this.w.size() > 0) {
                this.l.setImageResources(this.w);
            }
            if (this.t != null && this.t.size() >= 1) {
                this.m.setDatas(a(this.t, 8));
            }
            if (this.u != null && this.u.size() >= 1) {
                this.n.setDatas(a(this.u, 5));
            }
            this.c.removeAllViews();
            this.j = new com.aspire.yellowpage.view.al(this.f821a);
            this.j.c(15);
            this.j.b(Color.parseColor("#222222"));
            this.j.a(Color.parseColor("#dddddd"));
            this.i = this.j.a(this.v, this.x);
            this.c.addView(this.i);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onPause() {
        if (this.l != null) {
            this.l.a();
        }
        super.onPause();
    }

    @Override
    public void onResume() {
        this.p = this.z.b();
        this.f.setText(this.p);
        this.f.requestFocus();
        super.onResume();
        if (this.l != null) {
            this.l.b();
        }
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == cm.rl_find_ads) {
            g();
        }
        if (view.getId() == cm.rl_main_search_click) {
            this.s = new Intent(this.f821a, (Class<?>) SearchActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("city", this.p);
            bundle.putString("lastPage", "firstpage");
            this.s.putExtras(bundle);
            startActivity(this.s);
        }
        if (view.getId() == cm.layout_city_press) {
            this.s = new Intent(this.f821a, (Class<?>) ChooseCityActivity.class);
            startActivityForResult(this.s, 1000);
        }
    }

    private void g() {
        this.f821a.startActivity(com.aspire.yellowpage.utils.j.a().a(this.f821a, "http://pim.10086.cn/wap/activity.php?token=" + com.aspire.yellowpage.utils.j.a().c() + "&endpointId=" + com.aspire.yellowpage.utils.c.d(this.f821a) + "&version=" + com.aspire.yellowpage.utils.j.a().d() + "&channel=" + com.aspire.yellowpage.utils.j.a().e(), "发现"));
    }

    private void h() {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        int i = displayMetrics.widthPixels;
        int i2 = displayMetrics.heightPixels;
        this.z.a(i);
        this.z.b(i2);
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        if (i2 == 1002) {
            this.p = intent.getStringExtra("cityName");
            this.q = intent.getStringExtra("provinceName");
            this.p = com.aspire.yellowpage.utils.c.a(this.p);
            this.f.setText(this.p);
            this.z.b(this.p);
            this.z.d(this.q);
            com.aspire.yellowpage.i.a.a("firstpage", this.q, this.p);
        }
    }

    public void a() {
        this.k = new aq(this);
        this.f821a.registerReceiver(this.k, new IntentFilter("android.aspire.location.GET_LOCATION"));
    }

    public void b() {
        com.aspire.yellowpage.h.c.a(this.f821a).a();
    }

    public void i() {
        if (!TextUtils.isEmpty(this.p) && !this.f.getText().toString().equals(this.p)) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this.f821a);
            builder.setMessage("GPS定位到您当前在" + this.p + ",一键切换吗?");
            builder.setNegativeButton("取消", (DialogInterface.OnClickListener) null);
            builder.setPositiveButton("确定", new ar(this));
            builder.show();
        }
    }

    private void j() {
        this.z.a(System.currentTimeMillis());
        a.f806a.execute(new as(this));
    }

    public void k() {
        StringBuilder sb = new StringBuilder("");
        String a2 = com.aspire.yellowpage.d.a.a(this.f821a).a("asp_yp_index.txt");
        if (a2 == null || "".equals(a2)) {
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("asp_yp_index.txt")));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    } else {
                        sb.append(readLine);
                    }
                }
                a2 = sb.toString();
            } catch (Exception e) {
            }
        }
        com.aspire.yellowpage.g.a aVar = new com.aspire.yellowpage.g.a();
        aVar.e(a2);
        aVar.d(a2);
    }

    public void l() {
        new StringBuilder("");
        String a2 = com.aspire.yellowpage.d.a.a(this.f821a).a("ads.txt");
        if (!TextUtils.isEmpty(a2) && !a2.contains(Telephony.ThreadsColumns.ERROR)) {
            this.w = new com.aspire.yellowpage.g.a().f(a2);
        }
    }

    public void m() {
        a.f806a.execute(new at(this));
    }

    private void n() {
        if (!this.z.i()) {
            a.f806a.execute(new au(this));
        }
    }

    private void o() {
        com.aspire.yellowpage.i.a.a("firstpage", null, null, null);
    }

    public void p() {
        new SimpleDateFormat("dd");
        if (System.currentTimeMillis() >= this.z.j() + 604800000) {
            a.f806a.execute(new av(this));
        }
    }

    private ArrayList<ArrayList<com.aspire.yellowpage.e.h>> a(ArrayList<com.aspire.yellowpage.e.h> arrayList, int i) {
        ArrayList<ArrayList<com.aspire.yellowpage.e.h>> arrayList2 = new ArrayList<>();
        int size = arrayList.size();
        int i2 = size % i;
        int i3 = (size / i) + (i2 > 0 ? 1 : 0);
        for (int i4 = 0; i4 < i3; i4++) {
            ArrayList<com.aspire.yellowpage.e.h> arrayList3 = new ArrayList<>();
            if (i2 > 0 && i4 == i3 - 1) {
                for (int i5 = 0; i5 < i2; i5++) {
                    arrayList3.add(arrayList.get((i * i4) + i5));
                }
            } else {
                for (int i6 = 0; i6 < i; i6++) {
                    arrayList3.add(arrayList.get((i * i4) + i6));
                }
            }
            arrayList2.add(arrayList3);
        }
        return arrayList2;
    }

    public boolean c() {
        String a2 = com.aspire.yellowpage.d.a.a(a.b()).a("asp_yp_index.txt");
        new SimpleDateFormat("dd");
        return System.currentTimeMillis() >= com.aspire.yellowpage.c.a.a(a.b()).k() + com.umeng.analytics.a.h || TextUtils.isEmpty(a2);
    }

    public void d() {
        if (this.l != null) {
            this.l.a();
        }
    }

    public void e() {
        if (this.l != null) {
            this.l.b();
        }
    }

    public void q() {
        int a2 = com.aspire.yellowpage.d.e.a(this.f821a).a();
        if (com.aspire.yellowpage.utils.k.b()) {
            n();
            if (a2 > 0) {
                this.A.sendEmptyMessage(1014);
                return;
            } else {
                j();
                return;
            }
        }
        if (a2 > 0) {
            this.A.sendEmptyMessage(1014);
        } else {
            j();
        }
    }
}