summaryrefslogtreecommitdiffstats
path: root/src/com/cyngn/theme/widget/NavBarSpace.java
blob: 993e9cf972d92659aab5cea9a5423276a92cbcb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright (C) 2014 Cyanogen, Inc.
 */
package com.cyngn.theme.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import com.cyngn.theme.util.Utils;

/**
 * A simple view used to pad layouts so that content floats above the
 * navigation bar.  This is best used with transparent or translucent
 * navigation bars where the content can go behind them.
 */
public class NavBarSpace extends View {

    public NavBarSpace(Context context) {
        this(context, null);
    }

    public NavBarSpace(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public NavBarSpace(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        if (!Utils.hasNavigationBar(getContext())) {
            this.setVisibility(View.GONE);
        } else {
            this.setVisibility(View.VISIBLE);
        }
    }
}