Notch support
This commit is contained in:
parent
b5c6b2d343
commit
06a87d5704
5 changed files with 62 additions and 11 deletions
|
|
@ -0,0 +1,41 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
/*
|
||||
This is a temporally fix
|
||||
*/
|
||||
|
||||
public class StatusBarView extends View {
|
||||
|
||||
|
||||
public StatusBarView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public StatusBarView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public StatusBarView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(
|
||||
MeasureSpec.getSize(widthMeasureSpec), getStatusBarHeight(getResources()));
|
||||
}
|
||||
|
||||
public static int getStatusBarHeight(Resources r) {
|
||||
int result = 0;
|
||||
int resourceId = r.getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
result = r.getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
<!--The unused FrameLayout layout is necessary to prevent a crash on rotate-->
|
||||
|
||||
<com.sothree.slidinguppanel.SlidingUpPanelLayout
|
||||
xmlns:sothree="http://schemas.android.com/apk/res-auto"
|
||||
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/player_sliding_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
@ -65,12 +64,23 @@
|
|||
|
||||
<include layout="@layout/shadow_statusbar_toolbar" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.kabouzeid.gramophone.views.StatusBarView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/player_toolbar"
|
||||
style="@style/Toolbar"
|
||||
android:layout_marginTop="@dimen/status_bar_padding"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
<com.kabouzeid.gramophone.views.StatusBarView
|
||||
android:id="@+id/player_status_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/status_bar_padding" />
|
||||
|
||||
<View
|
||||
<com.kabouzeid.gramophone.views.StatusBarView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/status_bar_padding"
|
||||
android:background="@color/twenty_percent_black_overlay" />
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
<com.kabouzeid.gramophone.views.StatusBarView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/status_bar_padding" />
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<View xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.kabouzeid.gramophone.views.StatusBarView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/status_bar"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue