360卫士 v7.0.0版本的 MD5 值为:43bd4833fa68f33fd0b83c22ef29ce8a

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


package com.qihoo360.mobilesafe.ui.apull;

import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.qihoo360.i.a.BaseActivity;
import com.qihoo360.mobilesafe.R;
import com.qihoo360.mobilesafe.api.Tasks;
import com.qihoo360.mobilesafe.ui.common.layout.CommonTitleBar;
import com.qihoo360.mobilesafe.ui.common.loading.CommonProgressWheel;
import defpackage.axm;
import defpackage.cjp;
import defpackage.cko;
import defpackage.ckp;
import defpackage.ckq;
import defpackage.ckr;
import defpackage.ckt;
import defpackage.cwl;
import defpackage.cwn;
import defpackage.cxs;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.apache.http.client.HttpClient;

public class SecuritySearchActivity extends BaseActivity implements View.OnClickListener {
    private static final String a = SecuritySearchActivity.class.getSimpleName();
    private EditText b;

    private LinearLayout f641c;
    private TextView d;
    private ImageView e;
    private ListView f;
    private ViewGroup g;
    private FrameLayout h;
    private ckr i;
    private ckt j;

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.res_0x7f030064);
        b();
        if (cwn.a(this)) {
            a();
        } else {
            a(d());
        }
    }

    private void a() {
        this.j = new ckt(this);
        this.j.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, 1);
    }

    private void b() {
        ((CommonTitleBar) findViewById(R.id.res_0x7f0b00d6)).setTitle(R.string.res_0x7f0900d7);
        this.h = (FrameLayout) findViewById(R.id.res_0x7f0b01cb);
        this.f641c = (LinearLayout) findViewById(R.id.res_0x7f0b01c6);
        this.d = (TextView) findViewById(R.id.res_0x7f0b01c8);
        this.e = (ImageView) findViewById(R.id.res_0x7f0b01c7);
        this.b = (EditText) findViewById(R.id.res_0x7f0b01c5);
        this.f = (ListView) findViewById(R.id.res_0x7f0b01cc);
        this.e.setOnClickListener(this);
        this.d.setOnClickListener(this);
        this.b.setOnEditorActionListener(new cko(this));
        this.b.addTextChangedListener(new ckp(this));
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!TextUtils.isEmpty(this.b.getText().toString())) {
            this.f641c.setVisibility(0);
        } else {
            this.f641c.setVisibility(8);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (this.j != null && !this.j.isCancelled()) {
            this.j.cancel(true);
            this.j = null;
        }
        this.f.setAdapter((ListAdapter) null);
    }

    public boolean c() {
        String obj = this.b.getText().toString();
        if (obj == null) {
            return false;
        }
        String trim = obj.trim();
        if (TextUtils.isEmpty(trim)) {
            return false;
        }
        a(trim);
        return true;
    }

    public void a(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                SearchBrowserActivity.a(this, String.format(Locale.getDefault(), "http://m.so.com/s?q=%1$s&srcg=weishi_app&src=home_next", URLEncoder.encode(str, "UTF-8")), getString(R.string.res_0x7f0900d7));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
    }

    public static String b(Context context) {
        HttpClient a2 = cwl.a(cxs.a(context, axm.a(context)));
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(2048);
        if (cwl.a(a2, "http://m.so.com/mhtml/app_index/app_news.json?src=weishi_app", byteArrayOutputStream, 0L, null, 524288L, 0L) <= 0) {
            return null;
        }
        try {
            return new String(byteArrayOutputStream.toByteArray(), "UTF-8");
        } catch (Exception e) {
            return null;
        }
    }

    public List d() {
        BufferedInputStream bufferedInputStream;
        ByteArrayOutputStream byteArrayOutputStream;
        List list;
        ByteArrayOutputStream byteArrayOutputStream2 = null;
        try {
            bufferedInputStream = new BufferedInputStream(openFileInput("security_search_hot_word"));
            try {
                byteArrayOutputStream = new ByteArrayOutputStream(1024);
            } catch (Exception e) {
                byteArrayOutputStream = null;
            } catch (Throwable th) {
                th = th;
            }
        } catch (Exception e2) {
            byteArrayOutputStream = null;
            bufferedInputStream = null;
        } catch (Throwable th2) {
            th = th2;
            bufferedInputStream = null;
        }
        try {
            byte[] bArr = new byte[1024];
            while (true) {
                int read = bufferedInputStream.read(bArr);
                if (read == -1) {
                    break;
                }
                byteArrayOutputStream.write(bArr, 0, read);
            }
            List a2 = cjp.a(new String(byteArrayOutputStream.toByteArray(), "UTF-8"));
            try {
                bufferedInputStream.close();
            } catch (IOException e3) {
            }
            try {
                byteArrayOutputStream.close();
                list = a2;
            } catch (IOException e4) {
                list = a2;
            }
        } catch (Exception e5) {
            if (bufferedInputStream != null) {
                try {
                    bufferedInputStream.close();
                } catch (IOException e6) {
                }
            }
            if (byteArrayOutputStream != null) {
                try {
                    byteArrayOutputStream.close();
                    list = null;
                } catch (IOException e7) {
                    list = null;
                }
            } else {
                list = null;
            }
            if (list != null) {
            }
        } catch (Throwable th3) {
            byteArrayOutputStream2 = byteArrayOutputStream;
            th = th3;
            if (bufferedInputStream != null) {
                try {
                    bufferedInputStream.close();
                } catch (IOException e8) {
                }
            }
            if (byteArrayOutputStream2 == null) {
                throw th;
            }
            try {
                byteArrayOutputStream2.close();
                throw th;
            } catch (IOException e9) {
                throw th;
            }
        }
        return list != null ? new ArrayList() : list;
    }

    public void b(String str) {
        if (!TextUtils.isEmpty(str)) {
            Tasks.post2Thread(new ckq(this, str));
        }
    }

    private void e() {
        if (this.g != null) {
            this.g.setVisibility(8);
        }
        if (this.h != null) {
            this.h.setVisibility(8);
        }
    }

    public void f() {
        if (this.g == null) {
            this.g = (ViewGroup) findViewById(R.id.res_0x7f0b01c9);
            ((CommonProgressWheel) this.g.findViewById(R.id.res_0x7f0b01ca)).setWheelColor(-2434342);
        }
        this.g.setVisibility(0);
        this.h.setVisibility(8);
    }

    public void g() {
        if (this.g != null) {
            this.g.setVisibility(8);
        }
        this.h.setVisibility(0);
    }

    public void a(List list) {
        if (list == null || list.isEmpty()) {
            e();
            return;
        }
        Collections.sort(list);
        if (this.i == null) {
            this.i = new ckr(this, this);
            this.i.a(list);
            this.f.setAdapter((ListAdapter) this.i);
        } else {
            this.i.a(list);
        }
        this.i.notifyDataSetChanged();
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.res_0x7f0b01c7) {
            h();
        } else if (id == R.id.res_0x7f0b01c8) {
            c();
        }
    }

    private void h() {
        this.b.setText("");
        this.f641c.setVisibility(8);
    }
}