当前位置: 首页>>代码示例>>Java>>正文


Java CustomTabsHelper.addKeepAliveExtra方法代码示例

本文整理汇总了Java中org.chromium.customtabsclient.shared.CustomTabsHelper.addKeepAliveExtra方法的典型用法代码示例。如果您正苦于以下问题:Java CustomTabsHelper.addKeepAliveExtra方法的具体用法?Java CustomTabsHelper.addKeepAliveExtra怎么用?Java CustomTabsHelper.addKeepAliveExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.customtabsclient.shared.CustomTabsHelper的用法示例。


在下文中一共展示了CustomTabsHelper.addKeepAliveExtra方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchCustomTabs

import org.chromium.customtabsclient.shared.CustomTabsHelper; //导入方法依赖的package包/类
private void launchCustomTabs(String url) {
    String packageName = CustomTabsHelper.getPackageNameToUse(this);
    if (TextUtils.isEmpty(packageName)) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        return;
    }
    Intent snsIntent = new Intent(this, SessionBroadcastReceiver.class);
    PendingIntent snsPendingIntent = PendingIntent.getBroadcast(this, 121, snsIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder(session)
            .setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary))
            .setActionButton(ResourceUtil.createBitmap(SessionActivity.this, icons[0]), "SNS", snsPendingIntent)
            .addMenuItem("toggle", createRemoteViewPendingIntent(this))
            .setSecondaryToolbarViews(SessionBroadcastReceiver.createRemoteView(), ids, null)
            .build();
    customTabsIntent.intent.setPackage(packageName);
    CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
    customTabsIntent.launchUrl(this, Uri.parse(url));
}
 
开发者ID:sakebook,项目名称:CustomTabsSample,代码行数:20,代码来源:SessionActivity.java

示例2: launchCustomTabsWithSessionBottombar

import org.chromium.customtabsclient.shared.CustomTabsHelper; //导入方法依赖的package包/类
public void launchCustomTabsWithSessionBottombar(Activity activity, String url, @Nullable CustomTabsSession session) {
    String packageName = CustomTabsHelper.getPackageNameToUse(activity);
    if (TextUtils.isEmpty(packageName)) {
        activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    }
    CustomTabsIntent.Builder builder;
    if (session == null) {
        builder = new CustomTabsIntent.Builder();
    } else {
        builder = new CustomTabsIntent.Builder(session);
    }

    // Intent hacked
    Intent cctIntent = new CustomTabsIntent.Builder(session).build().intent;
    cctIntent.setData(Uri.parse(url));
    PendingIntent cctPendingIntent = PendingIntent.getActivity(activity, 124, cctIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    addSessionBottombar(builder, activity, cctPendingIntent);

    CustomTabsIntent customTabsIntent = builder
            .setToolbarColor(Color.WHITE)
            .build();
    CustomTabsHelper.addKeepAliveExtra(activity, customTabsIntent.intent);
    customTabsIntent.intent.setPackage(packageName);
    customTabsIntent.launchUrl(activity, Uri.parse(url));
}
 
开发者ID:sakebook,项目名称:CustomTabsSample,代码行数:27,代码来源:AdvanceActivity.java

示例3: launchCustomTabs

import org.chromium.customtabsclient.shared.CustomTabsHelper; //导入方法依赖的package包/类
private void launchCustomTabs(String url) {
    String packageName = CustomTabsHelper.getPackageNameToUse(this);
    if (TextUtils.isEmpty(packageName)) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        return;
    }
    // Put session
    CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder(session)
            .build();
    customTabsIntent.intent.setPackage(packageName);
    // Keep alive service
    CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
    customTabsIntent.launchUrl(this, Uri.parse(url));
}
 
开发者ID:sakebook,项目名称:CustomTabsSample,代码行数:15,代码来源:EventActivity.java


注:本文中的org.chromium.customtabsclient.shared.CustomTabsHelper.addKeepAliveExtra方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。