| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package android.support.customtabs; | 5 package android.support.customtabs; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.ActivityOptions; | 8 import android.app.ActivityOptions; |
| 9 import android.app.PendingIntent; | 9 import android.app.PendingIntent; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 /** | 85 /** |
| 86 * Bundle constructed out of {@link ActivityOptions} that will be running wh
en the | 86 * Bundle constructed out of {@link ActivityOptions} that will be running wh
en the |
| 87 * {@link Activity} that holds the custom tab gets finished. A similar Activ
ityOptions | 87 * {@link Activity} that holds the custom tab gets finished. A similar Activ
ityOptions |
| 88 * for creation should be constructed and given to the startActivity() call
that | 88 * for creation should be constructed and given to the startActivity() call
that |
| 89 * launches the custom tab. | 89 * launches the custom tab. |
| 90 */ | 90 */ |
| 91 public static final String EXTRA_EXIT_ANIMATION_BUNDLE = | 91 public static final String EXTRA_EXIT_ANIMATION_BUNDLE = |
| 92 "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE"; | 92 "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE"; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * Boolean that specifies whether a default share button will be shown in th
e menu. |
| 96 */ |
| 97 public static final String EXTRA_DEFAULT_SHARE_MENU_ITEM = |
| 98 "android.support.customtabs.extra.SHARE_MENU_ITEM"; |
| 99 |
| 100 /** |
| 95 * Convenience method to create a VIEW intent without a session for the give
n package. | 101 * Convenience method to create a VIEW intent without a session for the give
n package. |
| 96 * @param packageName The package name to set in the intent. | 102 * @param packageName The package name to set in the intent. |
| 97 * @param data The data {@link Uri} to be used in the intent. | 103 * @param data The data {@link Uri} to be used in the intent. |
| 98 * @return The intent with the given package, data and the right
session extra. | 104 * @return The intent with the given package, data and the right
session extra. |
| 99 */ | 105 */ |
| 100 public static Intent getViewIntentWithNoSession(String packageName, Uri data
) { | 106 public static Intent getViewIntentWithNoSession(String packageName, Uri data
) { |
| 101 Intent intent = new Intent(Intent.ACTION_VIEW, data); | 107 Intent intent = new Intent(Intent.ACTION_VIEW, data); |
| 102 intent.setPackage(packageName); | 108 intent.setPackage(packageName); |
| 103 Bundle extras = new Bundle(); | 109 Bundle extras = new Bundle(); |
| 104 if (!safePutBinder(extras, EXTRA_SESSION, null)) return null; | 110 if (!safePutBinder(extras, EXTRA_SESSION, null)) return null; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 Bundle.class.getMethod("putIBinder", String.class, IBind
er.class); | 129 Bundle.class.getMethod("putIBinder", String.class, IBind
er.class); |
| 124 putBinderMethod.invoke(bundle, key, binder); | 130 putBinderMethod.invoke(bundle, key, binder); |
| 125 } | 131 } |
| 126 } catch (InvocationTargetException | IllegalAccessException | IllegalArg
umentException | 132 } catch (InvocationTargetException | IllegalAccessException | IllegalArg
umentException |
| 127 | NoSuchMethodException e) { | 133 | NoSuchMethodException e) { |
| 128 return false; | 134 return false; |
| 129 } | 135 } |
| 130 return true; | 136 return true; |
| 131 } | 137 } |
| 132 } | 138 } |
| OLD | NEW |