导航菜单

页面标题

页面副标题

Hyouka private v5.8.9 - RatesFragmentActivity.java 源代码

正在查看: Hyouka private v5.8.9 应用的 RatesFragmentActivity.java JAVA 源代码文件

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


package com.beint.project.screens;

import android.app.Activity;
import android.app.SearchManager;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import androidx.appcompat.widget.SearchView;
import com.beint.project.adapter.RateCountryAdapter;
import com.beint.project.core.model.http.RateCountry;
import com.beint.project.core.model.http.RatesListItem;
import com.beint.project.core.utils.ZangiEngineUtils;
import com.beint.project.interfaces.OnBackPress;
import com.beint.project.screens.settings.more.settings.RatesCountryInfoFragment;
import com.beint.project.screens.settings.more.settings.RatesCountryListFragment;
import com.beint.project.screens.sms.AppModeNotifierActivity;
import com.beint.project.utils.color.ColorsManger;
import java.util.List;

public class RatesFragmentActivity extends AppModeNotifierActivity implements RatesManager {
    private String TAG = RatesFragmentActivity.class.getCanonicalName();
    private boolean backInSearchMode;
    private boolean canGoBack;
    public ListView countryListView;
    private String currencyCode;
    Activity mActivity;
    OnBackPress onBackPress;
    private RateCountryAdapter rateCountryAdapter;
    private RatesCountryInfoFragment ratesCountryInfoFragment;
    private RatesCountryListFragment ratesCountryListFragment;
    private MenuItem searchItem;
    private SearchView searchView;
    private RatesListItem selectedItem;
    private int stringLenght;

    static class AnonymousClass3 {
        static final int[] $SwitchMap$com$beint$project$screens$RatesFragmentActivity$StackEnum;

        static {
            int[] iArr = new int[StackEnum.values().length];
            $SwitchMap$com$beint$project$screens$RatesFragmentActivity$StackEnum = iArr;
            try {
                iArr[StackEnum.COUNTRY_LIST.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$beint$project$screens$RatesFragmentActivity$StackEnum[StackEnum.COUNTRY_INFO.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    public enum StackEnum {
        COUNTRY_LIST,
        COUNTRY_INFO
    }

    public void searchFunctional(String str) {
        this.backInSearchMode = true;
        this.rateCountryAdapter = this.ratesCountryListFragment.getRateCountryAdapter();
        if (str.length() > 0) {
            this.countryListView.setVisibility(0);
            this.ratesCountryListFragment.layoutSearchVisible();
            RatesCountryInfoFragment ratesCountryInfoFragment = this.ratesCountryInfoFragment;
            if (ratesCountryInfoFragment != null) {
                ratesCountryInfoFragment.layoutMainGone();
            }
        } else {
            this.countryListView.setVisibility(8);
            this.ratesCountryListFragment.layoutSearchGone();
            RatesCountryInfoFragment ratesCountryInfoFragment2 = this.ratesCountryInfoFragment;
            if (ratesCountryInfoFragment2 != null) {
                ratesCountryInfoFragment2.layoutMainVisible();
            }
        }
        if (this.stringLenght >= str.length()) {
            this.stringLenght = str.length();
            String replace = str.replace("+", "");
            RateCountryAdapter rateCountryAdapter = this.rateCountryAdapter;
            if (rateCountryAdapter == null || replace == null) {
                return;
            }
            rateCountryAdapter.getFilter().filter(replace);
            return;
        }
        this.stringLenght = str.length();
        RateCountryAdapter rateCountryAdapter2 = this.rateCountryAdapter;
        if (rateCountryAdapter2 == null || rateCountryAdapter2.getCount() <= 1) {
            return;
        }
        String replace2 = str.replace("+", "");
        if (replace2.startsWith("0")) {
            replace2 = replace2.replace("0", ZangiEngineUtils.getZipCode("0"));
        }
        this.rateCountryAdapter.getFilter().filter(replace2);
    }

    @Override
    public boolean canGoBack() {
        return this.canGoBack;
    }

    public boolean collapseSearchView() {
        MenuItem menuItem = this.searchItem;
        return menuItem != null && androidx.core.view.m0.a(menuItem);
    }

    @Override
    public ListView getCountryListView() {
        return this.countryListView;
    }

    public boolean isSearchViewExpanded() {
        MenuItem menuItem = this.searchItem;
        return menuItem != null && androidx.core.view.m0.c(menuItem);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.mActivity = this;
        setContentView(2131558693);
        View findViewById = findViewById(2131363849);
        if (findViewById != null) {
            findViewById.setVisibility(8);
        }
        setSupportActionBar(findViewById(2131363848));
        getSupportActionBar().v(false);
        getSupportActionBar().q(true);
        getSupportActionBar().r(true);
        getSupportActionBar().w(2131887249);
        ListView listView = (ListView) findViewById(2131362302);
        this.countryListView = listView;
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                if (RatesFragmentActivity.this.rateCountryAdapter == null) {
                    RatesFragmentActivity ratesFragmentActivity = RatesFragmentActivity.this;
                    ratesFragmentActivity.rateCountryAdapter = ratesFragmentActivity.ratesCountryListFragment.getRateCountryAdapter();
                }
                if (RatesFragmentActivity.this.rateCountryAdapter != null) {
                    RateCountry item = RatesFragmentActivity.this.rateCountryAdapter.getItem(i);
                    RatesListItem ratesListItem = new RatesListItem();
                    ratesListItem.setLandline(item.getLandline());
                    ratesListItem.setMobile(item.getMobile());
                    ratesListItem.setDescription(item.getCountryName());
                    ratesListItem.setPrices((List) null);
                    ratesListItem.setPhoneCode(item.getPhoneCode());
                    ratesListItem.setCode(item.getCountryCode());
                    RatesFragmentActivity.this.show(StackEnum.COUNTRY_INFO, ratesListItem, RatesFragmentActivity.this.ratesCountryListFragment != null ? RatesFragmentActivity.this.ratesCountryListFragment.getCurrenciesRate() : 0.0d);
                }
                if (RatesFragmentActivity.this.isSearchViewExpanded()) {
                    RatesFragmentActivity.this.collapseSearchView();
                }
            }
        });
        show(StackEnum.COUNTRY_LIST, null, 0.0d);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(2131689491, menu);
        SearchManager searchManager = (SearchManager) this.mActivity.getSystemService("search");
        MenuItem findItem = menu.findItem(2131363516);
        this.searchItem = findItem;
        SearchView actionView = findItem.getActionView();
        this.searchView = actionView;
        actionView.setMaxWidth(Integer.MAX_VALUE);
        SearchView.SearchAutoComplete findViewById = this.searchView.findViewById(l5.g.search_src_text);
        LinearLayout linearLayout = (LinearLayout) this.searchView.findViewById(l5.g.search_edit_frame);
        if (linearLayout != null) {
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) linearLayout.getLayoutParams();
            layoutParams.setMargins(0, layoutParams.topMargin, 0, layoutParams.bottomMargin);
            findViewById.setLayoutParams(layoutParams);
        }
        findViewById.setPadding(0, findViewById.getPaddingTop(), 0, findViewById.getPaddingBottom());
        findViewById.setTextColor(getResources().getColor(2131099817));
        findViewById.setHintTextColor(getResources().getColor(ColorsManger.color_white_trans_9));
        findViewById.setHint(2131887312);
        this.searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            public boolean onQueryTextChange(String str) {
                RatesFragmentActivity.this.searchFunctional(str);
                return false;
            }

            public boolean onQueryTextSubmit(String str) {
                return false;
            }
        });
        this.searchView.setSearchableInfo(searchManager.getSearchableInfo(this.mActivity.getComponentName()));
        return super/*android.app.Activity*/.onCreateOptionsMenu(menu);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == 16908332) {
            if (canGoBack()) {
                InputMethodManager inputMethodManager = (InputMethodManager) this.mActivity.getSystemService("input_method");
                if (getCountryListView() != null) {
                    inputMethodManager.hideSoftInputFromWindow(this.countryListView.getWindowToken(), 0);
                }
                show(StackEnum.COUNTRY_LIST, null, 0.0d);
            } else {
                finish();
            }
        }
        return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
    }

    public boolean processKeyDown(int i, KeyEvent keyEvent) {
        if (i != 4) {
            return i == 4;
        }
        if (this.backInSearchMode) {
            InputMethodManager inputMethodManager = (InputMethodManager) this.mActivity.getSystemService("input_method");
            if (getCountryListView() != null) {
                inputMethodManager.hideSoftInputFromWindow(this.countryListView.getWindowToken(), 0);
            }
            this.backInSearchMode = false;
        } else if (this.canGoBack) {
            show(StackEnum.COUNTRY_LIST, null, 0.0d);
        } else {
            finish();
        }
        return true;
    }

    @Override
    public void setCanGoBack(boolean z) {
        this.canGoBack = z;
    }

    @Override
    public void show(StackEnum stackEnum, RatesListItem ratesListItem, double d) {
        int i = AnonymousClass3.$SwitchMap$com$beint$project$screens$RatesFragmentActivity$StackEnum[stackEnum.ordinal()];
        if (i == 1) {
            RatesCountryListFragment ratesCountryListFragment = new RatesCountryListFragment();
            this.ratesCountryListFragment = ratesCountryListFragment;
            ratesCountryListFragment.setScreenManager(this);
            getSupportFragmentManager().n().r(2131363393, this.ratesCountryListFragment, this.TAG).i();
            return;
        }
        if (i != 2) {
            return;
        }
        RatesCountryInfoFragment ratesCountryInfoFragment = new RatesCountryInfoFragment();
        this.ratesCountryInfoFragment = ratesCountryInfoFragment;
        ratesCountryInfoFragment.setTopCountry(ratesListItem);
        this.ratesCountryInfoFragment.setCurrenciesRate(d);
        this.ratesCountryInfoFragment.setScreenManager(this);
        getSupportFragmentManager().n().r(2131363393, this.ratesCountryInfoFragment, this.TAG).i();
    }
}