• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BundleCompat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.support.v4.app.BundleCompat的典型用法代码示例。如果您正苦于以下问题:Java BundleCompat类的具体用法?Java BundleCompat怎么用?Java BundleCompat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BundleCompat类属于android.support.v4.app包,在下文中一共展示了BundleCompat类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onConnected

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
public void onConnected() {
    Bundle extras = MediaBrowserCompatApi21.getExtras(this.mBrowserObj);
    if (extras != null) {
        IBinder serviceBinder = BundleCompat.getBinder(extras, MediaBrowserProtocol.EXTRA_MESSENGER_BINDER);
        if (serviceBinder != null) {
            this.mServiceBinderWrapper = new ServiceBinderWrapper(serviceBinder);
            this.mCallbacksMessenger = new Messenger(this.mHandler);
            this.mHandler.setCallbacksMessenger(this.mCallbacksMessenger);
            try {
                this.mServiceBinderWrapper.registerCallbackMessenger(this.mCallbacksMessenger);
            } catch (RemoteException e) {
                Log.i(MediaBrowserCompat.TAG, "Remote error registering client messenger.");
            }
            onServiceConnected(this.mCallbacksMessenger, null, null, null);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:MediaBrowserCompat.java


示例2: Builder

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
public Builder(@Nullable CustomTabsSession session) {
    this.mIntent = new Intent("android.intent.action.VIEW");
    this.mMenuItems = null;
    this.mStartAnimationBundle = null;
    this.mActionButtons = null;
    if (session != null) {
        this.mIntent.setPackage(session.getComponentName().getPackageName());
    }

    Bundle bundle = new Bundle();
    BundleCompat.putBinder(bundle, "android.support.customtabs.extra.SESSION", session == null ? null : session.getBinder());
    this.mIntent.putExtras(bundle);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:14,代码来源:CustomTabsIntent.java


示例3: safeGetBinder

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Just like {@link BundleCompat#getBinder()}, but doesn't throw exceptions.
 */
public static IBinder safeGetBinder(Bundle bundle, String name) {
    if (bundle == null) return null;
    try {
        return BundleCompat.getBinder(bundle, name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "getBinder failed on bundle " + bundle);
        return null;
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:IntentUtils.java


示例4: safePutBinderExtra

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Inserts a {@link Binder} value into an Intent as an extra.
 *
 * Uses {@link BundleCompat#putBinder()}, but doesn't throw exceptions.
 *
 * @param intent Intent to put the binder into.
 * @param name Key.
 * @param binder Binder object.
 */
@VisibleForTesting
public static void safePutBinderExtra(Intent intent, String name, IBinder binder) {
    if (intent == null) return;
    Bundle bundle = new Bundle();
    try {
        BundleCompat.putBinder(bundle, name, binder);
    } catch (Throwable t) {
        // Catches parceling exceptions.
        Log.e(TAG, "putBinder failed on bundle " + bundle);
    }
    intent.putExtras(bundle);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:IntentUtils.java


示例5: putCustomTabsExtra

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
public static void putCustomTabsExtra(Intent intent) {
    // enable Custom Tabs if supported
    Bundle bundle = new Bundle();
    BundleCompat.putBinder(bundle, EXTRA_CUSTOM_TABS_SESSION, null);
    intent.putExtras(bundle);
    intent.putExtra(EXTRA_ENABLE_URLBAR_HIDING, true);
}
 
开发者ID:ykrank,项目名称:S1-Next,代码行数:8,代码来源:IntentUtil.java


示例6: getSessionTokenFromIntent

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
    Bundle b = intent.getExtras();
    IBinder binder = BundleCompat.getBinder(b, "android.support.customtabs.extra.SESSION");
    return binder == null ? null : new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:6,代码来源:CustomTabsSessionToken.java


示例7: testSerializeIBinder

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
@Test
public void testSerializeIBinder() {
    IBinder expectedValue = new Binder();
    mCoder.serialize(bundle(), randomKey(), expectedValue);
    assertEquals(expectedValue, BundleCompat.getBinder(bundle(), randomKey()));
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:7,代码来源:IBinderCoderTest.java


示例8: testDeserializeIBinder

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
@Test
public void testDeserializeIBinder() {
    IBinder expectedValue = new Binder();
    BundleCompat.putBinder(bundle(), randomKey(), expectedValue);
    assertEquals(expectedValue, mCoder.deserialize(bundle(), randomKey()));
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:7,代码来源:IBinderCoderTest.java


示例9: getSessionTokenFromIntent

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Obtain a {@link CustomTabsSessionToken} from an intent. See {@link CustomTabsIntent.Builder}
 * for ways to generate an intent for custom tabs.
 * @param intent The intent to generate the token from. This has to include an extra for
 *               {@link CustomTabsIntent#EXTRA_SESSION}.
 * @return The token that was generated.
 */
public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
    Bundle b = intent.getExtras();
    IBinder binder = BundleCompat.getBinder(b, CustomTabsIntent.EXTRA_SESSION);
    if (binder == null) return null;
    return new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:CustomTabsSessionToken.java


示例10: Builder

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Creates a {@link CustomTabsIntent.Builder} object associated with a given
 * {@link CustomTabsSession}.
 *
 * Guarantees that the {@link Intent} will be sent to the same component as the one the
 * session is associated with.
 *
 * @param session The session to associate this Builder with.
 */
public Builder(@Nullable CustomTabsSession session) {
    if (session != null) mIntent.setPackage(session.getComponentName().getPackageName());
    Bundle bundle = new Bundle();
    BundleCompat.putBinder(
            bundle, EXTRA_SESSION, session == null ? null : session.getBinder());
    mIntent.putExtras(bundle);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:CustomTabsIntent.java


示例11: launchAsTrustedWebActivity

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Launch the given {@link CustomTabsIntent} as a Trusted Web Activity. The given
 * {@link CustomTabsIntent} should have a valid {@link CustomTabsSession} associated with it
 * during construction. Once the Trusted Web Activity is launched, browser side implementations
 * may have their own fallback behavior (e.g. Showing the page in a custom tab UI with toolbar)
 * based on qualifications listed above or more.
 *
 * @param context {@link Context} to use while launching the {@link CustomTabsIntent}.
 * @param customTabsIntent The {@link CustomTabsIntent} to use for launching the
 *                         Trusted Web Activity. Note that all customizations in the given
 *                         associated with browser toolbar controls will be ignored.
 * @param uri The web page to launch as Trusted Web Activity.
 */
public static void launchAsTrustedWebActivity(@NonNull Context context,
        @NonNull CustomTabsIntent customTabsIntent, @NonNull Uri uri) {
    if (BundleCompat.getBinder(
            customTabsIntent.intent.getExtras(), CustomTabsIntent.EXTRA_SESSION) == null) {
        throw new IllegalArgumentException(
                "Given CustomTabsIntent should be associated with a valid CustomTabsSession");
    }
    customTabsIntent.intent.putExtra(EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY, true);
    customTabsIntent.launchUrl(context, uri);
}
 
开发者ID:GoogleChrome,项目名称:custom-tabs-client,代码行数:24,代码来源:TrustedWebUtils.java


示例12: getSessionTokenFromIntent

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Obtain a {@link CustomTabsSessionToken} from an intent. See {@link CustomTabsIntent.Builder}
 * for ways to generate an intent for custom tabs.
 *
 * @param intent The intent to generate the token from. This has to include an extra for
 *               {@link CustomTabsIntent#EXTRA_SESSION}.
 * @return The token that was generated.
 */
public static CustomTabsSessionToken getSessionTokenFromIntent(Intent intent) {
    Bundle b = intent.getExtras();
    IBinder binder = BundleCompat.getBinder(b, CustomTabsIntent.EXTRA_SESSION);
    if (binder == null) return null;
    return new CustomTabsSessionToken(ICustomTabsCallback.Stub.asInterface(binder));
}
 
开发者ID:plusCubed,项目名称:anticipate,代码行数:15,代码来源:CustomTabsSessionToken.java


示例13: serialize

import android.support.v4.app.BundleCompat; //导入依赖的package包/类
/**
 * Write a field's value into the saved state {@link Bundle}.
 *
 * @param state      {@link Bundle} used to save the state
 * @param key        key retrieved from {@code fieldDeclaringClass#fieldName}
 * @param fieldValue value of field
 */
@Override
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull IBinder fieldValue) {
    BundleCompat.putBinder(state, key, fieldValue);
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:12,代码来源:IBinderCoder.java



注:本文中的android.support.v4.app.BundleCompat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RestartStrategies类代码示例发布时间:2022-05-21
下一篇:
Java ParseFacebookUtils类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap