导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - FAQsActivity.java 源代码

正在查看: bbinstant v6.24.0 应用的 FAQsActivity.java JAVA 源代码文件

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


package com.bigbasket.bbinstant.ui.help;

import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager2.widget.ViewPager2;
import com.adjetter.kapchatsdk.R;
import com.bigbasket.bbinstant.ui.BaseActivity;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.c;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.v;

public final class FAQsActivity extends BaseActivity {
    public static final a Companion = new a(null);
    private static final int DELETE_REQ_CODE = 210;
    private static final String[] TABS = {"bbinstant APP", "FOOD"};

    public static final class a {
        public a(o oVar) {
            this();
        }

        public final int getDELETE_REQ_CODE() {
            return FAQsActivity.DELETE_REQ_CODE;
        }

        private a() {
        }
    }

    public static final void onCreate$lambda$0(TabLayout.Tab tab, int i) {
        v.checkNotNullParameter(tab, "tab");
        tab.setText(TABS[i]);
    }

    public final String getJsonFromAssets(String str) {
        v.checkNotNullParameter(str, "fileName");
        try {
            InputStream open = getAssets().open(str);
            v.checkNotNullExpressionValue(open, "getAssets().open(fileName)");
            byte[] bArr = new byte[open.available()];
            open.read(bArr);
            open.close();
            Charset forName = Charset.forName("UTF-8");
            v.checkNotNullExpressionValue(forName, "forName(\"UTF-8\")");
            return new String(bArr, forName);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131558436);
        setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
        ActionBar supportActionBar = getSupportActionBar();
        v.checkNotNull(supportActionBar);
        supportActionBar.setDisplayHomeAsUpEnabled(true);
        TabLayout findViewById = findViewById(2131362575);
        ViewPager2 viewPager2 = (ViewPager2) findViewById(2131362811);
        String jsonFromAssets = getJsonFromAssets("app_faq.json");
        Gson gson = new Gson();
        Type type = new TypeToken<HelpFAQ>() {
        }.getType();
        v.checkNotNullExpressionValue(type, "object : TypeToken<HelpFAQ?>() {}.type");
        Object fromJson = gson.fromJson(jsonFromAssets, type);
        v.checkNotNullExpressionValue(fromJson, "gson.fromJson(jsonFromAssets, listUserType)");
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        v.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
        viewPager2.setAdapter(new g(supportFragmentManager, getLifecycle(), (HelpFAQ) fromJson));
        new com.google.android.material.tabs.c(findViewById, viewPager2, new c.b() {
            public final void onConfigureTab(TabLayout.Tab tab, int i) {
                FAQsActivity.onCreate$lambda$0(tab, i);
            }
        }).attach();
        setTitle(getString(2131886476));
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        v.checkNotNullParameter(menuItem, "item");
        if (menuItem.getItemId() != 16908332) {
            return super.onOptionsItemSelected(menuItem);
        }
        onBackPressed();
        return true;
    }
}