导航菜单

页面标题

页面副标题

Aptoide v9.22.5.3 - CustomTabsHelper.java 源代码

正在查看: Aptoide v9.22.5.3 应用的 CustomTabsHelper.java JAVA 源代码文件

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


package cm.aptoide.pt.link;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.core.content.a;
import c.c.b.c;
import cm.aptoide.pt.R;

public class CustomTabsHelper {
    private static CustomTabsHelper customTabsHelper;

    private CustomTabsHelper() {
        if (customTabsHelper != null) {
            throw new IllegalStateException("Already instantiated");
        }
    }

    private void addRefererHttpHeader(Context context, c cVar) {
        Bundle bundle = new Bundle();
        bundle.putString("Referer", "http://m.aptoide.com");
        cVar.a.putExtra("com.android.browser.headers", bundle);
        cVar.a.getExtras();
        if (Build.VERSION.SDK_INT >= 22) {
            cVar.a.putExtra("android.intent.extra.REFERRER_NAME", "android-app://" + context.getPackageName() + "/");
        }
    }

    private c.a getBuilder(Context context, int i) {
        return new c.a().h(a.d(context, i)).f(true).d(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_arrow_back)).a().b(context.getString(R.string.customtabs_open_native_app), PendingIntent.getBroadcast(context.getApplicationContext(), 0, new Intent(context.getApplicationContext(), (Class<?>) CustomTabNativeReceiver.class), 67108864)).g(context, R.anim.slide_in_right, R.anim.slide_out_left).e(context, R.anim.slide_in_left, R.anim.slide_out_right);
    }

    public static CustomTabsHelper getInstance() {
        if (customTabsHelper == null) {
            customTabsHelper = new CustomTabsHelper();
        }
        return customTabsHelper;
    }

    public void openInChromeCustomTab(String str, Context context, int i) {
        c c2 = getBuilder(context, i).c();
        addRefererHttpHeader(context, c2);
        c2.a.setFlags(268435456);
        c2.a(context, Uri.parse(str));
    }
}