1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.support.v7.app; 18 19 import android.support.annotation.Nullable; 20 import android.support.v7.view.ActionMode; 21 22 /** 23 * Implemented this in order for AppCompat to be able to callback in certain situations. 24 * <p> 25 * This should be provided to 26 * {@link AppCompatDelegate#create(android.app.Activity, AppCompatCallback)}. 27 */ 28 public interface AppCompatCallback { 29 30 /** 31 * Called when a support action mode has been started. 32 * 33 * @param mode The new action mode. 34 */ onSupportActionModeStarted(ActionMode mode)35 void onSupportActionModeStarted(ActionMode mode); 36 37 /** 38 * Called when a support action mode has finished. 39 * 40 * @param mode The action mode that just finished. 41 */ onSupportActionModeFinished(ActionMode mode)42 void onSupportActionModeFinished(ActionMode mode); 43 44 /** 45 * Called when a support action mode is being started for this window. Gives the 46 * callback an opportunity to handle the action mode in its own unique and 47 * beautiful way. If this method returns null the system can choose a way 48 * to present the mode or choose not to start the mode at all. 49 * 50 * @param callback Callback to control the lifecycle of this action mode 51 * @return The ActionMode that was started, or null if the system should present it 52 */ 53 @Nullable onWindowStartingSupportActionMode(ActionMode.Callback callback)54 ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback); 55 56 } 57