179bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov/*
279bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * Copyright (C) 2015 The Android Open Source Project
379bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov *
479bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * Licensed under the Apache License, Version 2.0 (the "License");
579bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * you may not use this file except in compliance with the License.
679bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * You may obtain a copy of the License at
779bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov *
879bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov *      http://www.apache.org/licenses/LICENSE-2.0
979bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov *
1079bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * Unless required by applicable law or agreed to in writing, software
1179bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * distributed under the License is distributed on an "AS IS" BASIS,
1279bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1379bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * See the License for the specific language governing permissions and
1479bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov * limitations under the License.
1579bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov */
16e8c9f7dbd2d75bce83410ce4b6bcf5c1c69a7cfbKirill Grouchnikovpackage android.support.v7.custom;
1779bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
1879bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikovimport android.content.Context;
1927644c071b7fc0e1e4f91194f2a08b4aa2cf1465Aurimas Liutikasimport android.support.v4.widget.DrawerLayout;
2079bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikovimport android.util.AttributeSet;
2179bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikovimport android.view.WindowInsets;
2279bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
2379bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikovpublic class CustomDrawerLayout extends DrawerLayout {
2479bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    private int mSystemWindowInsetTop;
2579bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
2679bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    public CustomDrawerLayout(Context context) {
2779bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov        super(context);
2879bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    }
2979bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
3079bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    public CustomDrawerLayout(Context context, AttributeSet attrs) {
3179bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov        super(context, attrs);
3279bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    }
3379bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
3479bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    public CustomDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
3579bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov        super(context, attrs, defStyle);
3679bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    }
3779bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
38e2104f4b5c8e3ad63570306a25e61502dfe4c418Aurimas Liutikas    @Override
3979bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
4079bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov        mSystemWindowInsetTop = insets.getSystemWindowInsetTop();
4179bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov        return super.dispatchApplyWindowInsets(insets);
4279bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    }
4379bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov
4479bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    public int getSystemWindowInsetTop() {
4579bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov        return mSystemWindowInsetTop;
4679bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov    }
4779bdaf9f66d9000feb54d8f4011fc412dd7829bcKirill Grouchnikov}