fix display on kitkat devices

This commit is contained in:
Phillip Thelen 2017-04-19 13:57:17 +02:00
parent 5a09cd770a
commit 568cfb6f12
5 changed files with 14 additions and 11 deletions

View file

@ -46,8 +46,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/Toolbar"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.AppCompat.Light"
android:fitsSystemWindows="true"/>
app:popupTheme="@style/Theme.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
@ -66,8 +65,7 @@
app:layout_collapseMode="pin"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/white"
app:tabMode="fixed"
android:fitsSystemWindows="true" />
app:tabMode="fixed" />
</android.support.design.widget.AppBarLayout>
<LinearLayout

View file

@ -8,7 +8,6 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"

View file

@ -59,9 +59,11 @@ public class IntroActivity extends BaseActivity implements View.OnClickListener,
apiClient.getContent()
.subscribe(contentResult -> {}, throwable -> {});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_20_alpha));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_20_alpha));
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}

View file

@ -178,9 +178,11 @@ public class LoginActivity extends BaseActivity
backgroundContainer.post(() -> backgroundContainer.scrollTo(0, backgroundContainer.getBottom()));
backgroundContainer.setScrollingEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_20_alpha));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_20_alpha));
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}

View file

@ -289,9 +289,11 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
drawer.setSelectionAtPosition(1, false);
sideAvatarView = new AvatarView(this, true, false, false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_10_alpha));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black_10_alpha));
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
toolbar.setPadding(0, getStatusBarHeight(), 0, 0);
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics());