导航菜单

页面标题

页面副标题

OLX India v19.42.007 - SearchLocationByNameActivity.java 源代码

正在查看: OLX India v19.42.007 应用的 SearchLocationByNameActivity.java JAVA 源代码文件

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


package com.naspers.ragnarok.universal.ui.ui.location.activity;

import android.app.SearchManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.appcompat.f;
import androidx.appcompat.widget.SearchView;
import com.naspers.ragnarok.data.R;
import com.naspers.ragnarok.domain.constant.Constants;
import com.naspers.ragnarok.domain.entity.location.Place;
import com.naspers.ragnarok.universal.c;
import com.naspers.ragnarok.universal.d;
import com.naspers.ragnarok.universal.ui.ui.base.b;
import com.naspers.ragnarok.universal.ui.ui.common.util.g;
import com.naspers.ragnarok.universal.ui.ui.location.fragment.SearchLocationByNameFragment;
import java.util.Timer;
import java.util.TimerTask;

public class SearchLocationByNameActivity extends b implements SearchView.k, SearchLocationByNameFragment.b {
    private SearchView T;
    private SearchLocationByNameFragment U;
    private Timer V;

    class a implements SearchView.j {
        a() {
        }

        public boolean onClose() {
            return SearchLocationByNameActivity.this.E2();
        }
    }

    public String G2() {
        return String.valueOf(this.T.getQuery());
    }

    private SearchView.j H2() {
        return new a();
    }

    private void I2() {
        if (getIntent().hasExtra(Constants.ExtraKeys.PLACE)) {
            this.T.I(((Place) getIntent().getSerializableExtra(Constants.ExtraKeys.PLACE)).getName(), false);
        }
    }

    private void L2() {
        this.T.findViewById(f.search_plate).setBackgroundResource(c.ragnarok_textfield_searchview);
    }

    protected boolean E2() {
        if (G2().length() != 0) {
            return false;
        }
        K2("");
        return true;
    }

    protected void F2() {
        this.T.setSearchableInfo(((SearchManager) getSystemService("search")).getSearchableInfo(getComponentName()));
        this.T.setIconifiedByDefault(false);
        this.T.setIconified(false);
        this.T.setOnQueryTextListener(this);
        this.T.setImeOptions(3);
        this.T.setOnCloseListener(H2());
        this.T.setMaxWidth(Integer.MAX_VALUE);
        EditText editText = (EditText) this.T.findViewById(f.search_src_text);
        editText.setTextColor(getResources().getColor(R.color.ragnarok_primary));
        editText.setHintTextColor(getResources().getColor(R.color.ragnarok_primary_tint));
        g.g((ImageView) this.T.findViewById(f.search_close_btn), R.drawable.ragnarok_ic_clear, R.color.ragnarok_primary);
        this.T.setTextDirection(5);
        I2();
        L2();
    }

    protected void J2() {
        this.U.m5();
        Timer timer = this.V;
        if (timer != null) {
            timer.cancel();
        }
        this.V = new Timer();
        this.V.schedule(new TimerTask() {
            @Override
            public void run() {
                SearchLocationByNameActivity.this.U.v5(SearchLocationByNameActivity.this.G2());
            }
        }, 1000L);
    }

    protected void K2(String str) {
        Timer timer = this.V;
        if (timer != null) {
            timer.cancel();
        }
        this.U.v5(str);
    }

    @Override
    public void d0(String str) {
        this.T.I(str, false);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (bundle == null) {
            B2(true);
            SearchLocationByNameFragment searchLocationByNameFragment = new SearchLocationByNameFragment();
            this.U = searchLocationByNameFragment;
            v2(searchLocationByNameFragment, true);
        }
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(com.naspers.ragnarok.universal.f.ragnarok_menu_search_location_by_name, menu);
        this.T = menu.findItem(d.search).getActionView();
        F2();
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
    }

    public boolean onQueryTextChange(String str) {
        SearchLocationByNameFragment searchLocationByNameFragment = this.U;
        if (searchLocationByNameFragment == null) {
            finish();
            return false;
        }
        searchLocationByNameFragment.u5(str);
        if (str.isEmpty()) {
            K2(str);
            return false;
        }
        J2();
        return false;
    }

    public boolean onQueryTextSubmit(String str) {
        K2(str);
        return false;
    }
}