ActivityOptionsCompat.java revision 559b5e8554651ffc9f9cc639f8e363b9494fc98a
13a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton/* 23a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Copyright (C) 2012 The Android Open Source Project 33a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * 43a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Licensed under the Apache License, Version 2.0 (the "License"); 53a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * you may not use this file except in compliance with the License. 63a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * You may obtain a copy of the License at 73a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * 83a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * http://www.apache.org/licenses/LICENSE-2.0 93a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * 103a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Unless required by applicable law or agreed to in writing, software 113a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * distributed under the License is distributed on an "AS IS" BASIS, 123a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * See the License for the specific language governing permissions and 143a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * limitations under the License. 153a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 163a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 173a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonpackage android.support.v4.app; 183a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 19559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mountimport android.app.Activity; 203a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonimport android.content.Context; 213a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonimport android.graphics.Bitmap; 223a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonimport android.os.Build; 233a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonimport android.os.Bundle; 24559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mountimport android.support.v4.util.Pair; 253a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonimport android.view.View; 263a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 273a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton/** 283a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Helper for accessing features in {@link android.app.ActivityOptions} 293a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * introduced in API level 16 in a backwards compatible fashion. 303a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 313a96487b54eca412f51ad00b8f8096055e94dcbbJake Whartonpublic class ActivityOptionsCompat { 323a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton /** 333a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Create an ActivityOptions specifying a custom animation to run when the 343a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * activity is displayed. 353a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * 363a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param context Who is defining this. This is the application that the 373a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * animation resources will be loaded from. 383a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param enterResId A resource ID of the animation resource to use for the 393a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * incoming activity. Use 0 for no animation. 403a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param exitResId A resource ID of the animation resource to use for the 413a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * outgoing activity. Use 0 for no animation. 423a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @return Returns a new ActivityOptions object that you can use to supply 433a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * these options as the options Bundle when starting an activity. 443a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 453a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public static ActivityOptionsCompat makeCustomAnimation(Context context, 463a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton int enterResId, int exitResId) { 473a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton if (Build.VERSION.SDK_INT >= 16) { 483a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return new ActivityOptionsImplJB( 493a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton ActivityOptionsCompatJB.makeCustomAnimation(context, enterResId, exitResId)); 503a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 513a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return new ActivityOptionsCompat(); 523a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 533a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 543a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton /** 553a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Create an ActivityOptions specifying an animation where the new activity is 563a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * scaled from a small originating area of the screen to its final full 573a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * representation. 583a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * <p/> 593a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * If the Intent this is being used with has not set its 603a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * {@link android.content.Intent#setSourceBounds(android.graphics.Rect)}, 613a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * those bounds will be filled in for you based on the initial bounds passed 623a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * in here. 633a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * 643a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param source The View that the new activity is animating from. This 653a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * defines the coordinate space for startX and startY. 663a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param startX The x starting location of the new activity, relative to 673a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * source. 683a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param startY The y starting location of the activity, relative to source. 693a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param startWidth The initial width of the new activity. 703a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param startHeight The initial height of the new activity. 713a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @return Returns a new ActivityOptions object that you can use to supply 723a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * these options as the options Bundle when starting an activity. 733a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 743a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public static ActivityOptionsCompat makeScaleUpAnimation(View source, 753a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton int startX, int startY, int startWidth, int startHeight) { 763a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton if (Build.VERSION.SDK_INT >= 16) { 773a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return new ActivityOptionsImplJB( 783a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton ActivityOptionsCompatJB.makeScaleUpAnimation(source, startX, startY, 793a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton startWidth, startHeight)); 803a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 813a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return new ActivityOptionsCompat(); 823a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 833a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 843a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton /** 853a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Create an ActivityOptions specifying an animation where a thumbnail is 863a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * scaled from a given position to the new activity window that is being 873a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * started. 883a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * <p/> 893a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * If the Intent this is being used with has not set its 903a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * {@link android.content.Intent#setSourceBounds(android.graphics.Rect)}, 913a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * those bounds will be filled in for you based on the initial thumbnail 923a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * location and size provided here. 933a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * 943a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param source The View that this thumbnail is animating from. This 953a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * defines the coordinate space for startX and startY. 963a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param thumbnail The bitmap that will be shown as the initial thumbnail 973a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * of the animation. 983a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param startX The x starting location of the bitmap, relative to source. 993a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @param startY The y starting location of the bitmap, relative to source. 1003a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * @return Returns a new ActivityOptions object that you can use to supply 1013a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * these options as the options Bundle when starting an activity. 1023a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 1033a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public static ActivityOptionsCompat makeThumbnailScaleUpAnimation(View source, 1043a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton Bitmap thumbnail, int startX, int startY) { 1053a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton if (Build.VERSION.SDK_INT >= 16) { 1063a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return new ActivityOptionsImplJB( 1073a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton ActivityOptionsCompatJB.makeThumbnailScaleUpAnimation(source, thumbnail, 1083a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton startX, startY)); 1093a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1103a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return new ActivityOptionsCompat(); 1113a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1123a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 113559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount /** 114559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * Create an ActivityOptions to transition between Activities using cross-Activity scene 115559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * animations. This method carries the position of one shared element to the started Activity. 116559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * The position of <code>sharedElement</code> will be used as the epicenter for the 117559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * exit Transition. The position of the shared element in the launched Activity will be the 118559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * epicenter of its entering Transition. 119559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * 120559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * <p>This requires {@link android.view.Window#FEATURE_CONTENT_TRANSITIONS} to be 121559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * enabled on the calling Activity to cause an exit transition. The same must be in 122559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * the called Activity to get an entering transition.</p> 123559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @param activity The Activity whose window contains the shared elements. 124559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @param sharedElement The View to transition to the started Activity. sharedElement must 125559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * have a non-null sharedElementName. 126559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @param sharedElementName The shared element name as used in the target Activity. This may 127559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * be null if it has the same name as sharedElement. 128559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @return Returns a new ActivityOptions object that you can use to 129559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * supply these options as the options Bundle when starting an activity. 130559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount */ 131559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount public static ActivityOptionsCompat makeSceneTransitionAnimation(Activity activity, 132559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount View sharedElement, String sharedElementName) { 133559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount if (Build.VERSION.SDK_INT >= 21 || Build.VERSION.CODENAME.equals("L")) { 134559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount return new ActivityOptionsCompat.ActivityOptionsImpl21( 135559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount ActivityOptionsCompat21.makeSceneTransitionAnimation(activity, 136559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount sharedElement, sharedElementName)); 137559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 138559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount return new ActivityOptionsCompat(); 139559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 140559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount 141559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount /** 142559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * Create an ActivityOptions to transition between Activities using cross-Activity scene 143559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * animations. This method carries the position of multiple shared elements to the started 144559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * Activity. The position of the first element in sharedElements 145559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * will be used as the epicenter for the exit Transition. The position of the associated 146559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * shared element in the launched Activity will be the epicenter of its entering Transition. 147559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * 148559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * <p>This requires {@link android.view.Window#FEATURE_CONTENT_TRANSITIONS} to be 149559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * enabled on the calling Activity to cause an exit transition. The same must be in 150559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * the called Activity to get an entering transition.</p> 151559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @param activity The Activity whose window contains the shared elements. 152559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @param sharedElements The names of the shared elements to transfer to the called 153559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * Activity and their associated Views. The Views must each have 154559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * a unique shared element name. 155559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * @return Returns a new ActivityOptions object that you can use to 156559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount * supply these options as the options Bundle when starting an activity. 157559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount */ 158559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount public static ActivityOptionsCompat makeSceneTransitionAnimation(Activity activity, 159559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount Pair<View, String>... sharedElements) { 160559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount if (Build.VERSION.SDK_INT >= 21 || Build.VERSION.CODENAME.equals("L")) { 161559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount View[] views = null; 162559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount String[] names = null; 163559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount if (sharedElements != null) { 164559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount views = new View[sharedElements.length]; 165559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount names = new String[sharedElements.length]; 166559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount for (int i = 0; i < sharedElements.length; i++) { 167559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount views[i] = sharedElements[i].first; 168559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount names[i] = sharedElements[i].second; 169559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 170559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 171559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount return new ActivityOptionsCompat.ActivityOptionsImpl21( 172559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount ActivityOptionsCompat21.makeSceneTransitionAnimation(activity, views, names)); 173559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 174559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount return new ActivityOptionsCompat(); 175559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 1763a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 1773a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton private static class ActivityOptionsImplJB extends ActivityOptionsCompat { 1783a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton private final ActivityOptionsCompatJB mImpl; 1793a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 1803a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton ActivityOptionsImplJB(ActivityOptionsCompatJB impl) { 1813a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton mImpl = impl; 1823a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1833a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 1843a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton @Override 1853a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public Bundle toBundle() { 1863a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return mImpl.toBundle(); 1873a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1883a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 1893a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton @Override 1903a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public void update(ActivityOptionsCompat otherOptions) { 1913a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton if (otherOptions instanceof ActivityOptionsImplJB) { 1923a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton ActivityOptionsImplJB otherImpl = (ActivityOptionsImplJB)otherOptions; 1933a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton mImpl.update(otherImpl.mImpl); 1943a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1953a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1963a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 1973a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 198559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount private static class ActivityOptionsImpl21 extends ActivityOptionsCompat { 199559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount private final ActivityOptionsCompat21 mImpl; 200559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount 201559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount ActivityOptionsImpl21(ActivityOptionsCompat21 impl) { 202559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount mImpl = impl; 203559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 204559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount 205559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount @Override 206559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount public Bundle toBundle() { 207559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount return mImpl.toBundle(); 208559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 209559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount 210559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount @Override 211559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount public void update(ActivityOptionsCompat otherOptions) { 212559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount if (otherOptions instanceof ActivityOptionsCompat.ActivityOptionsImpl21) { 213559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount ActivityOptionsCompat.ActivityOptionsImpl21 214559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount otherImpl = (ActivityOptionsCompat.ActivityOptionsImpl21)otherOptions; 215559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount mImpl.update(otherImpl.mImpl); 216559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 217559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 218559b5e8554651ffc9f9cc639f8e363b9494fc98aGeorge Mount } 2193a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 2203a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton protected ActivityOptionsCompat() { 2213a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 2223a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 2233a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton /** 2243a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Returns the created options as a Bundle, which can be passed to 2253a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * {@link ActivityCompat#startActivity(android.app.Activity, android.content.Intent, android.os.Bundle)}. 2263a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Note that the returned Bundle is still owned by the ActivityOptions 2273a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * object; you must not modify it, but can supply it to the startActivity 2283a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * methods that take an options Bundle. 2293a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 2303a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public Bundle toBundle() { 2313a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton return null; 2323a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 2333a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton 2343a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton /** 2353a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * Update the current values in this ActivityOptions from those supplied in 2363a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * otherOptions. Any values defined in otherOptions replace those in the 2373a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton * base options. 2383a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton */ 2393a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton public void update(ActivityOptionsCompat otherOptions) { 2403a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton // Do nothing. 2413a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton } 2423a96487b54eca412f51ad00b8f8096055e94dcbbJake Wharton} 243