Remaking the download queue without the padding top set to an android constant.

This commit is contained in:
Anonymus Raccoon
2019-07-08 17:12:57 +02:00
parent c0b07bc1c2
commit 2f98334020
2 changed files with 19 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
using Android.App; using Android.App;
using Android.Graphics;
using Android.OS; using Android.OS;
using Android.Support.Design.Widget;
using Android.Support.V4.View;
using Android.Support.V7.App; using Android.Support.V7.App;
using Android.Support.V7.Widget; using Android.Support.V7.Widget;
using Android.Views; using Android.Views;
@@ -26,8 +27,9 @@ namespace Opus.Fragments
instance = this; instance = this;
SetContentView(Resource.Layout.DownloadQueue); SetContentView(Resource.Layout.DownloadQueue);
Toolbar ToolBar = FindViewById<Toolbar>(Resource.Id.toolbar); Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(ToolBar); ViewCompat.SetOnApplyWindowInsetsListener(toolbar, new FixToolbarPadding());
SetSupportActionBar(toolbar);
SupportActionBar.Title = GetString(Resource.String.download_queue); SupportActionBar.Title = GetString(Resource.String.download_queue);
SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.Close); SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.Close);
SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true);
@@ -96,5 +98,16 @@ namespace Opus.Fragments
return true; return true;
} }
}
class FixToolbarPadding : Java.Lang.Object, IOnApplyWindowInsetsListener
{
public WindowInsetsCompat OnApplyWindowInsets(View v, WindowInsetsCompat insets)
{
((AppBarLayout.LayoutParams)v.LayoutParameters).TopMargin = insets.SystemWindowInsetTop;
return insets;
}
} }
} }

View File

@@ -2,14 +2,14 @@
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical" > android:orientation="vertical" >
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@*android:dimen/status_bar_height" android:fitsSystemWindows="true"
android:background="?colorAccent" android:background="?colorAccent"
android:id="@+id/appbar" > android:id="@+id/appbar" >
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
@@ -21,6 +21,7 @@
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/list" android:id="@+id/list"
android:background="?android:colorBackground"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent" /> android:layout_width="match_parent" />