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.v4.view; 18 19 import android.view.View; 20 21 /** 22 * Listener for applying window insets on a view in a custom way. 23 * 24 * <p>Apps may choose to implement this interface if they want to apply custom policy 25 * to the way that window insets are treated for a view. If an OnApplyWindowInsetsListener 26 * is set, it's 27 * {@link #onApplyWindowInsets(android.view.View, WindowInsetsCompat) onApplyWindowInsets} 28 * method will be called instead of the View's own {@code onApplyWindowInsets} method. 29 * The listener may optionally call the parameter View's <code>onApplyWindowInsets</code> 30 * method to apply the View's normal behavior as part of its own.</p> 31 */ 32 public interface OnApplyWindowInsetsListener { 33 /** 34 * When {@link ViewCompat#setOnApplyWindowInsetsListener(View, OnApplyWindowInsetsListener) set} 35 * on a View, this listener method will be called instead of the view's own 36 * {@code onApplyWindowInsets} method. 37 * 38 * @param v The view applying window insets 39 * @param insets The insets to apply 40 * @return The insets supplied, minus any insets that were consumed 41 */ onApplyWindowInsets(View v, WindowInsetsCompat insets)42 public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets); 43 }