From 9c1ed53bf889db1ead53a3aa10c96b2f59e735ac Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 4 Nov 2019 15:53:24 +0100 Subject: [PATCH] Replace custom shadows by elevation attributes. This only works on Lollipop and above. KitKat users will not see shadows any more. --- oeffi/res/drawable/view_shadow_bottom.xml | 12 -------- oeffi/res/drawable/view_shadow_right.xml | 12 -------- oeffi/res/drawable/view_shadow_top.xml | 12 -------- oeffi/res/layout/action_bar.xml | 8 +++-- oeffi/res/layout/directions_content.xml | 17 +++++++---- .../directions_trip_details_content.xml | 17 ++++++----- .../directions_trip_overview_content.xml | 4 +-- oeffi/res/layout/favorites_content.xml | 4 +-- oeffi/res/layout/network_picker_content.xml | 30 +++++++------------ oeffi/res/layout/plans_picker_content.xml | 4 +-- oeffi/res/layout/stations_content.xml | 18 ++++++----- .../stations_station_details_content.xml | 18 ++++++----- oeffi/res/values/dimens.xml | 5 ++++ .../schildbach/oeffi/OeffiMainActivity.java | 1 - 14 files changed, 65 insertions(+), 97 deletions(-) delete mode 100644 oeffi/res/drawable/view_shadow_bottom.xml delete mode 100644 oeffi/res/drawable/view_shadow_right.xml delete mode 100644 oeffi/res/drawable/view_shadow_top.xml diff --git a/oeffi/res/drawable/view_shadow_bottom.xml b/oeffi/res/drawable/view_shadow_bottom.xml deleted file mode 100644 index ca937e7..0000000 --- a/oeffi/res/drawable/view_shadow_bottom.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/oeffi/res/drawable/view_shadow_right.xml b/oeffi/res/drawable/view_shadow_right.xml deleted file mode 100644 index 0beaa51..0000000 --- a/oeffi/res/drawable/view_shadow_right.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/oeffi/res/drawable/view_shadow_top.xml b/oeffi/res/drawable/view_shadow_top.xml deleted file mode 100644 index df1261e..0000000 --- a/oeffi/res/drawable/view_shadow_top.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/oeffi/res/layout/action_bar.xml b/oeffi/res/layout/action_bar.xml index fbe5b1c..d4d92e2 100644 --- a/oeffi/res/layout/action_bar.xml +++ b/oeffi/res/layout/action_bar.xml @@ -1,9 +1,13 @@ - + android:animateLayoutChanges="true" + android:elevation="@dimen/elevation_action_bar" + tools:targetApi="21"> - + android:orientation="horizontal"> + android:layout_height="match_parent" + android:elevation="@dimen/elevation_content" + tools:targetApi="21"> + android:elevation="@dimen/elevation_panel" + tools:targetApi="21"> @@ -100,8 +105,8 @@ android:id="@+id/directions_map_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - android:foreground="@drawable/view_shadow_right" - android:foregroundGravity="left|fill_vertical" > + android:elevation="@dimen/elevation_map" + tools:targetApi="21"> - + android:orientation="horizontal"> + android:orientation="vertical" + android:elevation="@dimen/elevation_content" + tools:targetApi="21"> + android:layout_height="match_parent"> + android:elevation="@dimen/elevation_map" + tools:targetApi="21"> + android:layout_height="match_parent"> + android:layout_height="match_parent"> - + android:elevation="@dimen/elevation_content" + android:orientation="horizontal" + tools:targetApi="21"> + android:layout_weight="1"> - - - - + android:layout_height="match_parent" /> @@ -59,8 +52,7 @@ android:id="@+id/network_picker_map_frame" android:layout_width="match_parent" android:layout_height="match_parent" - android:foreground="@drawable/view_shadow_right" - android:foregroundGravity="left|fill_vertical" > + android:elevation="@dimen/elevation_map"> + android:orientation="vertical"> - + android:orientation="horizontal"> + android:layout_height="match_parent" + android:elevation="@dimen/elevation_content" + tools:targetApi="21"> + android:layout_height="match_parent"> + android:elevation="@dimen/elevation_map" + tools:targetApi="21"> - + android:orientation="horizontal"> + android:elevation="@dimen/elevation_content" + android:orientation="vertical" + tools:targetApi="21"> + android:layout_height="match_parent"> + android:elevation="@dimen/elevation_map" + tools:targetApi="21"> 300dp 360dp + 0dp + 4dp + 6dp + 8dp + true false false diff --git a/oeffi/src/de/schildbach/oeffi/OeffiMainActivity.java b/oeffi/src/de/schildbach/oeffi/OeffiMainActivity.java index cb3b3ee..73a8d43 100644 --- a/oeffi/src/de/schildbach/oeffi/OeffiMainActivity.java +++ b/oeffi/src/de/schildbach/oeffi/OeffiMainActivity.java @@ -201,7 +201,6 @@ public abstract class OeffiMainActivity extends OeffiActivity { .addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); navigationDrawerListView.setAdapter(menuAdapter); - navigationDrawerLayout.setDrawerShadow(R.drawable.view_shadow_right, Gravity.LEFT); navigationDrawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() { public void onDrawerOpened(final View drawerView) { handler.postDelayed(() -> heartbeat.start(), 2000);