和通讯录 v4.2.0版本的 MD5 值为:f213fa766dccbfebde0dd8add5534518

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


package com.chinamobile.contacts.im.call.view;

import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Handler;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.internal.telephony.PhoneConstants;
import com.chinamobile.contacts.im.C0019R;
import com.chinamobile.contacts.im.Main;
import com.chinamobile.contacts.im.config.LoginInfoSP;
import com.chinamobile.contacts.im.data.ContactAccessor;
import com.chinamobile.contacts.im.data.simcard.MultiSimCardAccessor;
import com.chinamobile.contacts.im.jni.Jni;
import com.chinamobile.contacts.im.mms2.utils.TimingSmsUtil;
import com.chinamobile.contacts.im.utils.ApplicationUtils;
import com.chinamobile.contacts.im.utils.ca;
import com.chinamobile.contacts.im.utils.ci;
import com.chinamobile.contacts.im.utils.cm;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
import com.umeng.analytics.AspMobclickAgent;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;

public class ay implements View.OnClickListener, View.OnTouchListener {
    private static ay e;
    private String A;
    private String B;
    private String C;
    private com.chinamobile.contacts.im.contacts.c.y E;
    private com.chinamobile.contacts.im.contacts.c.p G;
    private long H;
    private Context I;
    private List<com.chinamobile.icloud.im.sync.a.n> K;
    private ViewGroup L;
    private Handler P;
    private int Q;
    private TextView R;
    private com.chinamobile.contacts.im.enterpriseContact.b.f S;
    private NotificationManager U;

    int f1517a;

    int f1518b;
    int c;
    int d;
    private WindowManager f;
    private WindowManager.LayoutParams g;
    private float h;
    private float i;
    private View j;
    private String l;
    private ImageButton m;
    private TextView n;
    private TextView o;
    private TextView p;
    private TextView q;
    private TextView r;
    private TextView s;
    private TextView t;
    private LinearLayout u;
    private ImageView v;
    private Bitmap w;
    private Bitmap x;
    private String y;
    private String z;
    private boolean k = false;
    private String D = "";
    private int F = 0;
    private String J = "";
    private boolean M = false;
    private boolean N = false;
    private boolean O = false;
    private boolean T = false;

    public static ay a(Context context) {
        if (e == null) {
            e = new ay(context);
        }
        return e;
    }

    private ay(Context context) {
        this.I = context;
        this.f = (WindowManager) this.I.getSystemService("window");
        c();
    }

    private void c() {
        this.P = new az(this);
    }

    public void d() {
        try {
            this.E = ContactAccessor.getContactInfoForPhoneNumber(this.J, this.I);
            if (this.E != null) {
                this.H = this.E.e();
                this.G = ContactAccessor.getInstance().getDetailContact((int) this.H);
            }
            if (this.G != null) {
                com.chinamobile.contacts.im.cloudserver.as.a(this.I, this.G);
            }
            if (this.G != null && this.G.getComingCallShow().size() > 0) {
                this.F = com.chinamobile.contacts.im.contacts.d.k.a(Integer.valueOf(this.G.getComingCallShow().get(0).h()).intValue());
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void e() {
        if (Build.MODEL.equals("Lenovo A320t") || Build.MODEL.equals("E601M") || Build.MODEL.equals("KONKA L813") || Build.MODEL.equals("Lenovo A5800-D") || Build.MODEL.equals("HUAWEI G628-TL00")) {
            this.j = View.inflate(this.I, C0019R.layout.ringing_call_layout_new_1, null);
        } else {
            this.j = View.inflate(this.I, C0019R.layout.ringing_call_layout_new_1, null);
        }
        this.j.setOnTouchListener(this);
        c(this.F);
        this.m = (ImageButton) this.j.findViewById(C0019R.id.ringing_call_close);
        this.m.setOnClickListener(this);
        this.u = (LinearLayout) this.j.findViewById(C0019R.id.attribution_layout);
        this.n = (TextView) this.j.findViewById(C0019R.id.loc_oper_label);
        this.t = (TextView) this.j.findViewById(C0019R.id.number_attribution_tv);
        this.v = (ImageView) this.j.findViewById(C0019R.id.ringing_person_icon);
        this.r = (TextView) this.j.findViewById(C0019R.id.call_colleague);
        this.o = (TextView) this.j.findViewById(C0019R.id.company_label);
        this.p = (TextView) this.j.findViewById(C0019R.id.recent_label);
        this.q = (TextView) this.j.findViewById(C0019R.id.name_label);
        this.q.setText(TextUtils.isEmpty(this.J) ? "" : this.J);
        this.L = (ViewGroup) this.j.findViewById(C0019R.id.notes);
        if (!l()) {
            if (Build.MODEL.equals("Haipai Noble D3") || Build.MODEL.equals("HL-6360T")) {
                this.j.setVisibility(8);
            }
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
            layoutParams.topMargin = ApplicationUtils.dip2px(this.I, 8.0f);
            this.R = new TextView(this.I);
            this.R.setTextColor(-13812144);
            this.R.setTextSize(11.0f);
            this.R.setGravity(17);
            this.L.removeAllViews();
            this.L.addView(this.R, layoutParams);
        }
        this.s = (TextView) this.j.findViewById(C0019R.id.ring_call_view_vice_number_text);
        int a2 = com.chinamobile.contacts.im.utils.l.a(this.J);
        if (a2 > 0 && a2 < 4 && LoginInfoSP.isHaveSubPhone(this.I)) {
            if (this.M) {
                this.s.setText(com.chinamobile.contacts.im.utils.l.d("" + a2) + "呼出");
            } else {
                this.s.setText(com.chinamobile.contacts.im.utils.l.d("" + a2) + "接听");
            }
            this.s.setTextColor(this.I.getResources().getColor(com.chinamobile.contacts.im.utils.l.a(a2)));
            this.s.setVisibility(0);
        }
    }

    public void f() {
        this.N = false;
        try {
            if (this.J == null) {
                this.J = "";
            }
            String d = ca.d(this.J);
            Jni.getInstance();
            String findLoc = Jni.findLoc(ca.a(this.J, true));
            String a2 = com.chinamobile.contacts.im.utils.z.a(this.J);
            if (this.J.length() > 10) {
                if (findLoc.length() + a2.length() < 1) {
                    this.D = "未知归属地";
                } else {
                    this.D = findLoc.replace("-", "") + " " + a2;
                }
            } else if (findLoc.length() < 1) {
                this.D = "";
            } else {
                this.D = findLoc;
            }
            this.y = this.D;
            ArrayList<com.chinamobile.contacts.im.call.c.b> loadCallLogs = ContactAccessor.getInstance().loadCallLogs(this.I, this.J);
            if (loadCallLogs == null || loadCallLogs.isEmpty()) {
                this.B = this.M ? "首次去电" : "首次来电";
            } else {
                long f = loadCallLogs.get(0).f();
                if (System.currentTimeMillis() - f < 1000 && loadCallLogs.get(1) != null) {
                    f = loadCallLogs.get(1).f();
                }
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(TimingSmsUtil.format);
                simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+08:00"));
                this.l = simpleDateFormat.format(new Date(f));
                this.B = "上次通话: " + this.l;
                com.chinamobile.contacts.im.utils.bm.d("whj", "record" + f);
            }
            this.w = ContactAccessor.getInstance().loadContactPhoto(this.H, true, true, true);
            if (this.F == 0 || this.F == 3 || this.F == 4) {
                this.x = com.chinamobile.contacts.im.cloudserver.as.a(this.I, true);
            } else {
                this.x = com.chinamobile.contacts.im.cloudserver.as.a(this.I, false);
            }
            com.chinamobile.contacts.im.utils.bm.d("long", "mCallerLocOper = " + this.y + " mCallerRecent = " + this.B);
            new com.chinamobile.contacts.im.enterpriseContact.b.f();
            if (LoginInfoSP.isLogin(this.I)) {
                com.chinamobile.contacts.im.enterpriseContact.b.f a3 = com.chinamobile.contacts.im.enterpriseContact.a.b.a(this.I).a(this.J);
                if (a3 != null) {
                    com.chinamobile.contacts.im.utils.bm.d("whj", "----同事----" + this.J);
                    this.C = a3.e;
                    a3.h = TextUtils.isEmpty(a3.h) ? "" : a3.h;
                    a3.i = TextUtils.isEmpty(a3.i) ? "" : a3.i;
                    this.z = a3.i;
                    this.A = "";
                    this.y = this.J;
                    this.O = true;
                } else if (LoginInfoSP.isLogin(this.I)) {
                    this.N = true;
                    com.chinamobile.contacts.im.utils.bm.d("whj", "----网络搜索----");
                    new be(this, null).executeOnMainExecutor(new Object[0]);
                }
            }
            if (d.equals("-2")) {
                this.C = "私人号码";
                this.y = this.J;
                return;
            }
            if (d.equals("18818812590")) {
                this.C = "多方通话号码";
                this.y = this.J;
                return;
            }
            if (d.equals("-1") || TextUtils.isEmpty(d)) {
                this.C = "未知号码";
                this.y = this.J;
                return;
            }
            if (this.E == null || this.G == null) {
                if (!this.O) {
                    cm cmVar = ci.a().c().get(d);
                    if (cmVar == null) {
                        this.C = this.J;
                        return;
                    }
                    String str = cmVar.f3803a;
                    if (TextUtils.isEmpty(str)) {
                        this.C = this.J;
                        return;
                    } else {
                        this.C = str;
                        this.y = this.J;
                        return;
                    }
                }
                return;
            }
            this.C = this.G.getStructuredName().b();
            this.y = this.J;
            if (this.G.getOrganizations().size() > 0) {
                String a4 = this.G.getOrganizations().get(0).a();
                String str2 = TextUtils.isEmpty(a4) ? "" : a4;
                String d2 = this.G.getOrganizations().get(0).d();
                String c = this.G.getOrganizations().get(0).c();
                if (TextUtils.isEmpty(d2)) {
                    d2 = "";
                }
                if (TextUtils.isEmpty(c)) {
                    c = "";
                }
                this.z = str2 + " " + d2;
                this.A = c;
            }
            this.K = this.G.getNotes();
        } catch (Exception e2) {
            com.chinamobile.contacts.im.utils.bm.a("RingingCallState", "Exception = " + e2);
        }
    }

    public void a(String str, int i) {
        if (!TextUtils.isEmpty(str)) {
            if (i == 10 || i == 11) {
                this.J = str;
                this.Q = i;
                this.M = this.Q == 10;
                if (!this.k) {
                    this.k = true;
                    Main.c.execute(new ba(this));
                }
            }
        }
    }

    public void g() {
        e();
        i();
        try {
            this.f.addView(this.j, this.g);
            try {
                AspMobclickAgent.onResume(this.I);
            } catch (Exception e2) {
                e2.printStackTrace();
                com.chinamobile.contacts.im.feiliao.e.a("AspMobclickAgent", e2.toString());
            }
            Main.c.execute(new bb(this));
        } catch (Exception e3) {
            this.k = false;
            this.j = null;
            e = null;
            h();
            e3.printStackTrace();
        }
    }

    public void a(int i) {
        new Handler().postDelayed(new bc(this), i);
    }

    public void a() {
        boolean z = false;
        try {
            if (this.k) {
                if (this.j != null) {
                    this.f.removeView(this.j);
                    this.k = false;
                    z = true;
                }
                this.j = null;
                e = null;
                h();
                if (z) {
                    AspMobclickAgent.onPause(this.I);
                }
            }
        } catch (Exception e2) {
            com.chinamobile.contacts.im.feiliao.e.a("AspMobclickAgent", e2.toString());
        }
    }

    private void h() {
        if (this.v != null) {
            this.v.setImageBitmap(null);
        }
        if (this.w != null) {
            this.w.recycle();
        }
        if (this.x != null) {
            this.x.recycle();
        }
    }

    private void i() {
        this.g = new WindowManager.LayoutParams();
        this.g.type = n();
        this.g.format = 1;
        this.g.flags = 40;
        if (ApplicationUtils.isSumSam()) {
            this.g.gravity = 16;
        } else {
            this.g.gravity = 48;
        }
        this.g.width = ApplicationUtils.phoneWidth(this.I);
        this.g.height = d(this.g.width);
        this.g.y = -100;
        if (Build.MODEL.equals("Lenovo A320t") || Build.MODEL.equals("E601M") || Build.MODEL.equals("Lenovo A5800-D") || Build.MODEL.equals("KONKA L813")) {
        }
        if (Build.MODEL.equals("HUAWEI G628-TL00")) {
        }
        this.g.windowAnimations = C0019R.style.call_show_anim;
    }

    public void j() {
        if (this.O) {
            this.r.setVisibility(0);
        }
        if (com.chinamobile.contacts.im.cloudserver.aj.a().a(this.I, this.J)) {
            this.r.setText("家庭网");
            this.r.setVisibility(0);
        }
        this.q.setText(this.C);
        o();
        p();
        this.p.setText(this.B);
        if (this.w != null && !this.w.isRecycled()) {
            this.v.setImageBitmap(this.w);
        } else {
            this.T = ci.a().a(this.J, this.v, 0);
        }
        if (!l() && !this.O) {
            m();
        }
        if (this.K != null && !this.K.isEmpty()) {
            this.L.removeAllViews();
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
            layoutParams.rightMargin = ApplicationUtils.dip2px(this.I, 5.0f);
            layoutParams.topMargin = ApplicationUtils.dip2px(this.I, 5.0f);
            for (com.chinamobile.icloud.im.sync.a.n nVar : this.K) {
                TextView textView = new TextView(this.I);
                textView.setText(nVar.a());
                textView.setTextColor(this.I.getResources().getColor(C0019R.color.white));
                textView.setBackgroundResource(com.chinamobile.contacts.im.contacts.d.s.a(0));
                textView.setSingleLine();
                textView.setEllipsize(TextUtils.TruncateAt.END);
                if (!TextUtils.isEmpty(textView.getText())) {
                    this.L.addView(textView, layoutParams);
                }
            }
        }
        if (Build.MODEL.equals(MultiSimCardAccessor.MODEL_HTC_RHYME_S510B)) {
            a(BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT);
        }
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case C0019R.id.ringing_call_close:
                AspMobclickAgent.onEvent(this.I, "cloudServer_incomingShow_closeBtn");
                a();
                return;
            default:
                return;
        }
    }

    @Override
    @SuppressLint({"ClickableViewAccessibility"})
    public boolean onTouch(View view, MotionEvent motionEvent) {
        switch (motionEvent.getAction()) {
            case 0:
                this.f1517a = (int) motionEvent.getRawX();
                this.f1518b = (int) motionEvent.getRawY();
                this.c = this.g.x;
                this.d = this.g.y;
                break;
            case 1:
                a(motionEvent);
                this.i = 0.0f;
                this.h = 0.0f;
                break;
            case 2:
                try {
                    a(motionEvent);
                    break;
                } catch (Exception e2) {
                    e2.printStackTrace();
                    break;
                }
        }
        if (view == this.j && motionEvent.getAction() == 1) {
            a();
            try {
                this.f.removeView(view);
                AspMobclickAgent.onPause(this.I);
                return false;
            } catch (Exception e3) {
                e3.printStackTrace();
                com.chinamobile.contacts.im.feiliao.e.a("AspMobclickAgent", e3.toString());
                return false;
            }
        }
        return false;
    }

    private void a(MotionEvent motionEvent) {
        try {
            int rawX = ((int) motionEvent.getRawX()) - this.f1517a;
            int rawY = ((int) motionEvent.getRawY()) - this.f1518b;
            this.g.x = rawX + this.c;
            this.g.y = rawY + this.d;
            this.f.updateViewLayout(this.j, this.g);
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public boolean k() {
        return ((TelephonyManager) this.I.getSystemService(PhoneConstants.PHONE_KEY)).getCallState() == 1;
    }

    private boolean l() {
        return this.E != null;
    }

    public NotificationManager b() {
        if (this.U == null) {
            this.U = (NotificationManager) this.I.getSystemService("notification");
        }
        return this.U;
    }

    private void m() {
        com.chinamobile.contacts.im.call.c.c a2 = com.chinamobile.contacts.im.call.b.h.a().a(this.J);
        if (a2 != null) {
            b(a2);
            if (!this.T) {
                a(a2);
                if (this.w != null && !this.w.isRecycled()) {
                    this.v.setImageBitmap(this.w);
                    return;
                }
                return;
            }
            return;
        }
        Main.c.execute(new bd(this));
    }

    public void a(com.chinamobile.contacts.im.call.c.c cVar) {
        if (cVar != null) {
            if (cVar.a().contains("骚扰")) {
                this.w = b(C0019R.drawable.ico_sr);
                return;
            }
            if (cVar.a().contains("诈骗")) {
                this.w = b(C0019R.drawable.ico_zp);
                return;
            }
            if (cVar.a().contains("推销")) {
                this.w = b(C0019R.drawable.ico_ggtx);
                return;
            }
            if (cVar.a().contains("快递")) {
                this.w = b(C0019R.drawable.ico_kd);
                return;
            } else if (cVar.a().contains("中介")) {
                this.w = b(C0019R.drawable.ico_fczj);
                return;
            } else {
                this.w = null;
                return;
            }
        }
        this.w = null;
    }

    private Bitmap b(int i) {
        try {
            return BitmapFactory.decodeStream(this.I.getResources().openRawResource(i));
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    private void c(int i) {
        ImageView imageView = (ImageView) this.j.findViewById(C0019R.id.bg_callwin_im);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
        layoutParams.height = d(ApplicationUtils.phoneWidth(this.I));
        imageView.setLayoutParams(layoutParams);
        imageView.setImageResource(com.chinamobile.contacts.im.utils.n.c(this.F));
        imageView.requestLayout();
    }

    private int d(int i) {
        return (i * com.chinamobile.contacts.im.mms2.d.g.ADD_FAVO) / 1080;
    }

    public void b(com.chinamobile.contacts.im.call.c.c cVar) {
        if (cVar.b() == com.aspire.strangecallssdk.a.b.k) {
            this.o.setText("由我贡献的标记 " + cVar.a());
            this.o.setVisibility(0);
        } else if (TextUtils.isEmpty(cVar.toString())) {
            this.o.setVisibility(8);
        } else {
            this.o.setText(cVar.toString());
            this.o.setVisibility(0);
        }
    }

    private int n() {
        return Build.VERSION.SDK_INT >= 19 ? 2005 : 2002;
    }

    private void o() {
        if (TextUtils.isEmpty(this.y) && TextUtils.isEmpty(this.D)) {
            this.u.setVisibility(8);
            return;
        }
        this.u.setVisibility(0);
        if (this.y.equals(this.D)) {
            this.n.setText("");
            this.t.setText(this.D);
            return;
        }
        this.n.setText(this.y);
        if (!TextUtils.isEmpty(this.D)) {
            this.t.setText("(" + this.D + ")");
        } else {
            this.t.setText("");
        }
    }

    private void p() {
        boolean isEmpty = TextUtils.isEmpty(this.z);
        this.z = isEmpty ? "" : this.z;
        boolean isEmpty2 = TextUtils.isEmpty(this.A);
        this.A = isEmpty2 ? "" : this.A;
        if (isEmpty && isEmpty2) {
            this.o.setVisibility(8);
        } else {
            this.o.setText(this.z + " " + this.A);
            this.o.setVisibility(0);
        }
    }
}