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 17package android.support.v4.view; 18 19import android.graphics.Rect; 20import android.view.WindowInsets; 21 22class WindowInsetsCompatApi21 extends WindowInsetsCompat { 23 24 private final WindowInsets mSource; 25 26 WindowInsetsCompatApi21(WindowInsets source) { 27 mSource = source; 28 } 29 30 @Override 31 public int getSystemWindowInsetLeft() { 32 return mSource.getSystemWindowInsetLeft(); 33 } 34 35 @Override 36 public int getSystemWindowInsetTop() { 37 return mSource.getSystemWindowInsetTop(); 38 } 39 40 @Override 41 public int getSystemWindowInsetRight() { 42 return mSource.getSystemWindowInsetRight(); 43 } 44 45 @Override 46 public int getSystemWindowInsetBottom() { 47 return mSource.getSystemWindowInsetBottom(); 48 } 49 50 @Override 51 public boolean hasSystemWindowInsets() { 52 return mSource.hasSystemWindowInsets(); 53 } 54 55 @Override 56 public boolean hasInsets() { 57 return mSource.hasInsets(); 58 } 59 60 @Override 61 public boolean isConsumed() { 62 return mSource.isConsumed(); 63 } 64 65 @Override 66 public boolean isRound() { 67 return mSource.isRound(); 68 } 69 70 @Override 71 public WindowInsetsCompat consumeSystemWindowInsets() { 72 return new WindowInsetsCompatApi21(mSource.consumeSystemWindowInsets()); 73 } 74 75 @Override 76 public WindowInsetsCompat replaceSystemWindowInsets(int left, int top, int right, int bottom) { 77 return new WindowInsetsCompatApi21(mSource.replaceSystemWindowInsets(left, top, right, bottom)); 78 } 79 80 @Override 81 public WindowInsetsCompat replaceSystemWindowInsets(Rect systemWindowInsets) { 82 return new WindowInsetsCompatApi21(mSource.replaceSystemWindowInsets(systemWindowInsets)); 83 } 84 85 @Override 86 public int getStableInsetTop() { 87 return mSource.getStableInsetTop(); 88 } 89 90 @Override 91 public int getStableInsetLeft() { 92 return mSource.getStableInsetLeft(); 93 } 94 95 @Override 96 public int getStableInsetRight() { 97 return mSource.getStableInsetRight(); 98 } 99 100 @Override 101 public int getStableInsetBottom() { 102 return mSource.getStableInsetBottom(); 103 } 104 105 @Override 106 public boolean hasStableInsets() { 107 return mSource.hasStableInsets(); 108 } 109 110 @Override 111 public WindowInsetsCompat consumeStableInsets() { 112 return new WindowInsetsCompatApi21(mSource.consumeStableInsets()); 113 } 114 115 WindowInsets unwrap() { 116 return mSource; 117 } 118} 119