blob: 71dce4d1e8a8c0abe0809760b93ed4613b8f30e5 (
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
|
/*
* 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 onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (!Utils.hasNavigationBar(mContext)) {
int width = MeasureSpec.getSize(widthMeasureSpec);
setMeasuredDimension(width, 0);
}
}
}
|