导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - SearchRoomActivity.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 SearchRoomActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.showself.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.f.a.a.a.b;
import com.mifeng.ui.R;
import com.r.b.q1;
import com.r.b.t1;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.showself.domain.GetSearchRoomParser;
import com.showself.domain.GetSearchUserParser;
import com.showself.domain.LoginResultInfo;
import com.showself.domain.SearchUserInfo;
import com.showself.show.bean.AttentionRoomInfo;
import com.showself.show.view.MSearchHistoryView;
import com.showself.utils.Utils;
import com.showself.utils.r;
import com.showself.utils.r0;
import com.showself.utils.u0;
import com.showself.view.ImmersiveStatusBar;
import com.showself.view.PullToRefreshView;
import com.showself.view.n;
import com.showself.view.q;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import com.tencent.smtt.sdk.TbsListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

public class SearchRoomActivity extends com.showself.ui.c implements View.OnClickListener, PullToRefreshView.b {
    private String A;
    private q C;
    private LoginResultInfo I;
    private EditText a;
    private ListView b;
    private TextView c;
    private ImageView d;

    private LinearLayout f2845e;

    private RelativeLayout f2846f;

    private PullToRefreshView f2847g;

    private n f2848h;

    private ImmersiveStatusBar f2849i;

    private RecyclerView f2850j;

    private SmartRefreshLayout f2851k;
    private ArrayList<AttentionRoomInfo> l;
    private View m;
    private q1 o;
    private t1 r;
    private com.r.m.a.n s;
    private MSearchHistoryView t;
    private RelativeLayout u;
    private TextView v;
    private String z;
    private ArrayList<SearchUserInfo> n = new ArrayList<>();
    private boolean p = true;
    private boolean q = false;
    private List<String> w = new ArrayList();
    private int x = 0;
    private Handler y = new a();
    private int B = 1;
    public boolean G = false;
    public boolean H = false;

    class a extends Handler {
        a() {
        }

        @Override
        public void handleMessage(Message message) {
            if (SearchRoomActivity.this.y == null) {
                return;
            }
            SearchRoomActivity.this.refresh(Integer.valueOf(message.what), message.obj, Integer.valueOf(message.arg1));
        }
    }

    class b implements TextView.OnEditorActionListener {
        b() {
        }

        @Override
        public boolean onEditorAction(TextView textView, int i2, KeyEvent keyEvent) {
            if (i2 != 3) {
                return true;
            }
            SearchRoomActivity.this.R(textView);
            return true;
        }
    }

    class c implements TextWatcher {
        c() {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (SearchRoomActivity.this.a.getText() == null || SearchRoomActivity.this.a.getText().toString().length() <= 0) {
                SearchRoomActivity.this.f2845e.setVisibility(0);
                SearchRoomActivity.this.f2846f.setVisibility(8);
                SearchRoomActivity.this.d.setVisibility(8);
                return;
            }
            SearchRoomActivity searchRoomActivity = SearchRoomActivity.this;
            searchRoomActivity.G = false;
            searchRoomActivity.f2845e.setVisibility(8);
            SearchRoomActivity.this.f2846f.setVisibility(0);
            SearchRoomActivity.this.d.setVisibility(0);
            SearchRoomActivity.this.x = 0;
            SearchRoomActivity.this.T();
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
        }
    }

    class d implements View.OnClickListener {
        d() {
        }

        @Override
        public void onClick(View view) {
            com.r.n.g j2 = com.r.n.g.j();
            com.r.n.d c = com.r.n.d.c();
            c.e("RoomSearch");
            c.f("Search");
            c.d("Page");
            c.h(com.r.n.e.Click);
            j2.u(c.b());
            String charSequence = ((TextView) view).getText().toString();
            SearchRoomActivity.this.a.setText(charSequence);
            SearchRoomActivity.this.a.setSelection(charSequence.length());
            SearchRoomActivity searchRoomActivity = SearchRoomActivity.this;
            searchRoomActivity.G = true;
            searchRoomActivity.x = 0;
            SearchRoomActivity.this.T();
        }
    }

    class e implements AbsListView.OnScrollListener {
        int a;

        e() {
        }

        @Override
        public void onScroll(AbsListView absListView, int i2, int i3, int i4) {
            int i5 = (i2 + i3) - 1;
            if (this.a == 0 || i5 != i4 - 1 || !SearchRoomActivity.this.p || SearchRoomActivity.this.q) {
                return;
            }
            SearchRoomActivity.this.T();
        }

        @Override
        public void onScrollStateChanged(AbsListView absListView, int i2) {
            this.a = i2;
            if (i2 == 1) {
                SearchRoomActivity.this.H = true;
            }
        }
    }

    class f implements b.h {
        f() {
        }

        public void c(com.f.a.a.a.b bVar, View view, int i2) {
            ?? r4 = SearchRoomActivity.this;
            com.showself.ui.show.g.j(r4, ((AttentionRoomInfo) ((SearchRoomActivity) r4).l.get(i2)).roomid, ((AttentionRoomInfo) SearchRoomActivity.this.l.get(i2)).replay_id, ((AttentionRoomInfo) SearchRoomActivity.this.l.get(i2)).big_avatar, ((AttentionRoomInfo) SearchRoomActivity.this.l.get(i2)).getContextMap());
        }
    }

    class g implements com.r.c.d {
        g() {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            SearchRoomActivity.this.P((HashMap) obj);
        }
    }

    class h implements com.r.c.d {
        h() {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            SearchRoomActivity.this.P((HashMap) obj);
        }
    }

    class i implements com.r.c.d {
        i() {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            ArrayList<AttentionRoomInfo> json2Bean;
            if (obj instanceof JSONObject) {
                JSONObject jSONObject = (JSONObject) obj;
                int optInt = jSONObject.optInt("statuscode");
                jSONObject.optString("message");
                if (optInt == 0) {
                    SearchRoomActivity.this.l.clear();
                    JSONObject optJSONObject = jSONObject.optJSONObject("data");
                    if (optJSONObject == null || (json2Bean = AttentionRoomInfo.json2Bean(optJSONObject, "entities", null)) == null || json2Bean.size() <= 0) {
                        return;
                    }
                    SearchRoomActivity.this.l.addAll(json2Bean);
                    SearchRoomActivity.this.s.notifyDataSetChanged();
                }
            }
        }
    }

    private void O() {
        new com.r.c.c(com.r.c.c.k("v2/homepage/guessyoulike", 1), new com.r.c.a(), new com.r.c.b(1), this).v(new i());
    }

    public void P(HashMap<Object, Object> hashMap) {
        this.f2847g.k();
        this.q = false;
        if (hashMap != null) {
            int intValue = ((Integer) hashMap.get(com.showself.net.e.n1)).intValue();
            String str = (String) hashMap.get(com.showself.net.e.o1);
            if (intValue != 0) {
                this.f2848h.b(R.drawable.fish_nothing, this.A, TbsListener.ErrorCode.STARTDOWNLOAD_8);
                Utils.Z0(this, str);
                return;
            }
            this.H = false;
            List list = (List) hashMap.get("members");
            if (this.x == 0) {
                this.n.clear();
            }
            if (list != null && !list.isEmpty()) {
                this.n.addAll(list);
                this.x += list.size();
            }
            if (((Integer) hashMap.get("is_next")).intValue() == 1) {
                this.p = true;
            } else {
                this.p = false;
            }
            if (this.p) {
                this.f2848h.d(0);
            } else {
                ArrayList<SearchUserInfo> arrayList = this.n;
                if (arrayList == null || arrayList.size() <= 0) {
                    this.f2848h.c(R.drawable.icon_no_search_result, this.A, r.a(110.0f), r.a(110.0f), TbsListener.ErrorCode.STARTDOWNLOAD_8);
                } else {
                    this.f2848h.d(2);
                }
            }
            if (this.B != 1) {
                this.r.notifyDataSetChanged();
                return;
            }
            if (this.n.size() > 0) {
                JSONArray jSONArray = new JSONArray();
                for (int i2 = 0; i2 < this.n.size(); i2++) {
                    jSONArray.put(this.n.get(i2).getRoomid());
                }
                com.r.n.g j2 = com.r.n.g.j();
                com.r.n.d c2 = com.r.n.d.c();
                c2.e("RoomSearch");
                c2.f("Search");
                c2.d("RoomList");
                c2.h(com.r.n.e.FlipUp);
                c2.a("rooms", jSONArray.toString());
                j2.u(c2.b());
            }
            this.o.b(this.n);
        }
    }

    private void Q() {
        O();
    }

    public void R(View view) {
        ((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(view.getWindowToken(), 2);
        this.x = 0;
        T();
        String obj = this.a.getText().toString();
        if (TextUtils.isEmpty(obj)) {
            return;
        }
        if (this.u.getVisibility() != 0) {
            this.u.setVisibility(0);
        }
        List<String> T = r0.T();
        boolean z = true;
        if (T != null && T.size() > 0) {
            for (int i2 = 0; i2 < T.size(); i2++) {
                if (obj.equals(T.get(i2))) {
                    z = false;
                }
            }
        }
        if (z) {
            this.t.a(this.a.getText().toString());
        }
    }

    private void S() {
        if (this.p) {
            this.f2848h.d(0);
        } else {
            this.f2848h.d(2);
        }
        if (this.B == 1) {
            this.o.notifyDataSetChanged();
        } else {
            this.r.notifyDataSetChanged();
        }
    }

    public void T() {
        try {
            if (this.q) {
                return;
            }
            String H0 = Utils.H0(this.a.getText().toString().trim());
            if (TextUtils.isEmpty(H0)) {
                Utils.Y0(this, R.string.content_cannot_benull);
                this.f2847g.k();
                return;
            }
            if (this.x == 0) {
                this.f2848h.d(0);
            } else {
                this.f2848h.d(1);
            }
            this.q = true;
            if (this.B != 1) {
                com.r.c.a aVar = new com.r.c.a();
                String k2 = com.r.c.c.k(com.showself.net.e.D, 0);
                GetSearchUserParser getSearchUserParser = new GetSearchUserParser();
                aVar.e("keyword", H0);
                aVar.b("type", 1);
                aVar.b("isUser", 1);
                aVar.b("startindex", this.x);
                aVar.b("recordnum", 20);
                new com.r.c.c(k2, aVar, getSearchUserParser, this).y(new h());
                return;
            }
            new com.r.c.c(com.r.c.c.k("v2/homepage/searchroom", 1) + "&keyword=" + H0 + "&startindex=" + this.x + "&recordnum=20", new com.r.c.a(), new GetSearchRoomParser(), this).v(new g());
        } catch (IllegalArgumentException unused) {
            Utils.X0(R.string.tex_input_content_error);
            this.a.setText("");
            this.f2847g.k();
            this.q = false;
        }
    }

    private void U(String str, int i2, int i3, boolean z) {
        if (this.I == null) {
            this.I = r0.y(this);
        }
        com.r.n.g j2 = com.r.n.g.j();
        com.r.n.d c2 = com.r.n.d.c();
        c2.e("RoomSearch");
        c2.f("Search");
        c2.d(str);
        c2.h(com.r.n.e.Click);
        c2.a(Oauth2AccessToken.KEY_UID, Integer.valueOf(this.I.getUserId()));
        c2.a("touid", Integer.valueOf(i2));
        c2.a("subtype", Integer.valueOf(i3));
        c2.a("status", Boolean.valueOf(z));
        j2.u(c2.b());
    }

    private void V() {
        q qVar = new q();
        this.C = qVar;
        qVar.g(false);
        View inflate = LayoutInflater.from(this).inflate(R.layout.layout_clear_history_dialog, (ViewGroup) null);
        TextView textView = (TextView) inflate.findViewById(R.id.tv_clear_cancel);
        TextView textView2 = (TextView) inflate.findViewById(R.id.tv_clear_confirm);
        textView.setOnClickListener(this);
        textView2.setOnClickListener(this);
        this.C.k(this, inflate, 1.0f, 17, r.a(255.0f), r.a(128.0f), 2131755759);
    }

    public void M() {
        String obj = this.a.getText().toString();
        if (TextUtils.isEmpty(obj)) {
            return;
        }
        if (this.u.getVisibility() != 0) {
            this.u.setVisibility(0);
        }
        List<String> T = r0.T();
        boolean z = true;
        if (T != null && T.size() > 0) {
            for (int i2 = 0; i2 < T.size(); i2++) {
                if (obj.equals(T.get(i2))) {
                    z = false;
                }
            }
        }
        if (z) {
            this.t.a(this.a.getText().toString());
        }
    }

    public void N(int r8, int r9, int r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.showself.ui.SearchRoomActivity.N(int, int, int):void");
    }

    @Override
    public void init() {
        this.l = new ArrayList<>();
        this.d = (ImageView) findViewById(R.id.search_edit_close);
        this.f2849i = (ImmersiveStatusBar) findViewById(2131298726);
        EditText editText = (EditText) findViewById(R.id.et_search_key);
        this.a = editText;
        editText.setHint(this.z);
        this.a.setOnEditorActionListener(new b());
        this.a.addTextChangedListener(new c());
        this.f2845e = (LinearLayout) findViewById(R.id.ll_history);
        this.f2846f = (RelativeLayout) findViewById(R.id.rl_result);
        TextView textView = (TextView) findViewById(R.id.tv_clear_history);
        this.v = textView;
        textView.setOnClickListener(this);
        MSearchHistoryView mSearchHistoryView = (MSearchHistoryView) findViewById(R.id.m_search_view);
        this.t = mSearchHistoryView;
        mSearchHistoryView.setMyOnclickListener(new d());
        this.u = (RelativeLayout) findViewById(R.id.rlv_room_search_history);
        this.f2851k = (SmartRefreshLayout) findViewById(R.id.recommend_refresh);
        this.f2850j = findViewById(R.id.recommend_recycler);
        TextView textView2 = (TextView) findViewById(R.id.tv_cancel);
        this.c = textView2;
        textView2.setOnClickListener(this);
        this.d.setOnClickListener(this);
        this.f2847g = (PullToRefreshView) findViewById(R.id.refresh_search);
        this.b = (ListView) findViewById(R.id.lv_search_content);
        n nVar = new n(this);
        this.f2848h = nVar;
        View a2 = nVar.a();
        this.m = a2;
        this.b.addFooterView(a2);
        if (this.B == 2) {
            t1 t1Var = new t1(this, this, this, this.n);
            this.r = t1Var;
            this.b.setAdapter((ListAdapter) t1Var);
            this.A = getResources().getString(R.string.search_not_find_user);
        } else {
            this.A = getResources().getString(R.string.search_not_find_anchor);
            q1 q1Var = new q1(this, this, this.n);
            this.o = q1Var;
            this.b.setAdapter((ListAdapter) q1Var);
        }
        ((TextView) this.m.findViewById(2131299508)).setText(this.A);
        this.b.setOnScrollListener(new e());
        this.f2847g.setOnHeaderRefreshListener(this);
        com.r.m.a.n nVar2 = new com.r.m.a.n(R.layout.layout_search_recommend_item, this.l, this);
        this.s = nVar2;
        nVar2.i0(new f());
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
        gridLayoutManager.setOrientation(1);
        this.f2850j.setLayoutManager(gridLayoutManager);
        this.f2850j.setAdapter(this.s);
        this.f2851k.E(false);
        this.f2851k.D(false);
        List<String> T = r0.T();
        this.w = T;
        if (T == null || T.size() <= 0) {
            this.u.setVisibility(8);
        } else {
            this.t.setData(this.w);
            this.u.setVisibility(0);
        }
        this.G = false;
    }

    @Override
    public void onClick(View view) {
        if (Utils.o0()) {
        }
        int id = view.getId();
        if (id == 2131298624) {
            this.a.setText("");
            return;
        }
        if (id == 2131298983) {
            com.r.n.g j2 = com.r.n.g.j();
            com.r.n.d c2 = com.r.n.d.c();
            c2.e("RoomSearch");
            c2.f("Search");
            c2.d("Cancel");
            c2.h(com.r.n.e.Click);
            j2.u(c2.b());
            onBackPressed();
            return;
        }
        switch (id) {
            case R.id.tv_clear_cancel:
                this.C.b();
                break;
            case R.id.tv_clear_confirm:
                this.C.b();
                this.u.setVisibility(8);
                r0.g();
                this.t.b();
                break;
            case R.id.tv_clear_history:
                V();
                break;
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_search_room);
        u0.q(this, null);
        Intent intent = getIntent();
        this.z = intent.getStringExtra("hint");
        this.B = intent.getIntExtra("searchType", 1);
        init();
        Q();
        u0.i(this, this.f2849i, 2131099661, true);
    }

    @Override
    public void onDestroy() {
        this.y = null;
        super.onDestroy();
    }

    @Override
    public void p(PullToRefreshView pullToRefreshView) {
        this.x = 0;
        this.p = true;
        T();
    }

    @Override
    public void refresh(Object... objArr) {
        this.q = false;
        this.f2847g.k();
        int intValue = ((Integer) objArr[0]).intValue();
        HashMap hashMap = (HashMap) objArr[1];
        if (hashMap != null) {
            int intValue2 = ((Integer) hashMap.get(com.showself.net.e.n1)).intValue();
            String str = (String) hashMap.get(com.showself.net.e.o1);
            if (intValue == 10052) {
                if (intValue2 == com.showself.net.e.m1 || intValue2 == -770) {
                    this.f2847g.f();
                    Utils.Z0(this, str);
                } else {
                    Utils.Z0(this, str);
                }
            }
            S();
        }
    }
}