Replace custom shadows by elevation attributes.

This only works on Lollipop and above. KitKat users will not see shadows any more.
This commit is contained in:
Andreas Schildbach 2019-11-04 15:53:24 +01:00
parent 99477d496b
commit 9c1ed53bf8
14 changed files with 65 additions and 97 deletions

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="270"
android:endColor="#0000"
android:startColor="#20000000" >
</gradient>
<size android:height="8dp" />
</shape>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#0000"
android:startColor="#20000000" >
</gradient>
<size android:width="8dp" />
</shape>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="90"
android:endColor="#0000"
android:startColor="#20000000" >
</gradient>
<size android:height="8dp" />
</shape>

View file

@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<de.schildbach.oeffi.MyActionBar xmlns:android="http://schemas.android.com/apk/res/android" <de.schildbach.oeffi.MyActionBar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/action_bar" android:id="@+id/action_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="true" > android:animateLayoutChanges="true"
android:elevation="@dimen/elevation_action_bar"
tools:targetApi="21">
<ImageButton <ImageButton
android:id="@+id/action_bar_menu_button" android:id="@+id/action_bar_menu_button"

View file

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" > android:orientation="horizontal">
<androidx.drawerlayout.widget.DrawerLayout <androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/navigation_drawer_layout" android:id="@+id/navigation_drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent"
android:elevation="@dimen/elevation_content"
tools:targetApi="21">
<LinearLayout <LinearLayout
android:id="@+id/directions_content_layout" android:id="@+id/directions_content_layout"
@ -86,7 +90,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:layout_gravity="top"
android:background="@android:color/white" android:background="@android:color/white"
android:elevation="3dp" > android:elevation="@dimen/elevation_panel"
tools:targetApi="21">
<include layout="@layout/directions_form_include" /> <include layout="@layout/directions_form_include" />
</ScrollView> </ScrollView>
@ -100,8 +105,8 @@
android:id="@+id/directions_map_fragment" android:id="@+id/directions_map_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:foreground="@drawable/view_shadow_right" android:elevation="@dimen/elevation_map"
android:foregroundGravity="left|fill_vertical" > tools:targetApi="21">
<de.schildbach.oeffi.OeffiMapView <de.schildbach.oeffi.OeffiMapView
android:id="@+id/directions_map" android:id="@+id/directions_map"

View file

@ -1,25 +1,26 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/stations_layout" android:id="@+id/stations_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" > android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/directions_trip_details_list_frame" android:id="@+id/directions_trip_details_list_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:orientation="vertical"
android:elevation="@dimen/elevation_content"
tools:targetApi="21">
<include layout="@layout/action_bar" /> <include layout="@layout/action_bar" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal" >
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -121,8 +122,8 @@
android:id="@+id/directions_trip_details_map_frame" android:id="@+id/directions_trip_details_map_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:foreground="@drawable/view_shadow_right" android:elevation="@dimen/elevation_map"
android:foregroundGravity="left|fill_vertical" > tools:targetApi="21">
<de.schildbach.oeffi.OeffiMapView <de.schildbach.oeffi.OeffiMapView
android:id="@+id/directions_trip_details_map" android:id="@+id/directions_trip_details_map"

View file

@ -8,9 +8,7 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal" >
<de.schildbach.oeffi.directions.TripsGallery <de.schildbach.oeffi.directions.TripsGallery
android:id="@+id/trips_bar_view" android:id="@+id/trips_bar_view"

View file

@ -9,9 +9,7 @@
<ViewAnimator <ViewAnimator
android:id="@+id/favorites_layout" android:id="@+id/favorites_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal" >
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/favorites_list" android:id="@+id/favorites_list"

View file

@ -1,10 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/stations_layout" android:id="@+id/stations_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" > android:elevation="@dimen/elevation_content"
android:orientation="horizontal"
tools:targetApi="21">
<LinearLayout <LinearLayout
android:id="@+id/network_picker_list_frame" android:id="@+id/network_picker_list_frame"
@ -17,8 +21,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal"
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView
@ -36,21 +38,12 @@
android:id="@+id/network_picker_firsttime_message_shadow" android:id="@+id/network_picker_firsttime_message_shadow"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0px" android:layout_height="0px"
android:layout_weight="1" android:layout_weight="1">
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal" >
<FrameLayout <androidx.recyclerview.widget.RecyclerView
android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:foreground="@drawable/view_shadow_top"
android:foregroundGravity="bottom|fill_horizontal" >
<androidx.recyclerview.widget.RecyclerView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -59,8 +52,7 @@
android:id="@+id/network_picker_map_frame" android:id="@+id/network_picker_map_frame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:foreground="@drawable/view_shadow_right" android:elevation="@dimen/elevation_map">
android:foregroundGravity="left|fill_vertical" >
<de.schildbach.oeffi.OeffiMapView <de.schildbach.oeffi.OeffiMapView
android:id="@+id/network_picker_map" android:id="@+id/network_picker_map"

View file

@ -15,9 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:foreground="@drawable/view_shadow_bottom" android:orientation="vertical">
android:foregroundGravity="top|fill_horizontal"
android:orientation="vertical" >
<TextView <TextView
android:id="@+id/plans_picker_connectivity_warning_box" android:id="@+id/plans_picker_connectivity_warning_box"

View file

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" > android:orientation="horizontal">
<androidx.drawerlayout.widget.DrawerLayout <androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/navigation_drawer_layout" android:id="@+id/navigation_drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent"
android:elevation="@dimen/elevation_content"
tools:targetApi="21">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -19,9 +23,7 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal" >
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -402,8 +404,8 @@
android:id="@+id/stations_map_fragment" android:id="@+id/stations_map_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:foreground="@drawable/view_shadow_right" android:elevation="@dimen/elevation_map"
android:foregroundGravity="left|fill_vertical" > tools:targetApi="21">
<de.schildbach.oeffi.OeffiMapView <de.schildbach.oeffi.OeffiMapView
android:id="@+id/stations_map" android:id="@+id/stations_map"

View file

@ -1,23 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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:baselineAligned="false" android:baselineAligned="false"
android:orientation="horizontal" > android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/stations_station_details_list_fragment" android:id="@+id/stations_station_details_list_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:elevation="@dimen/elevation_content"
android:orientation="vertical"
tools:targetApi="21">
<include layout="@layout/action_bar" /> <include layout="@layout/action_bar" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:foreground="@drawable/view_shadow_bottom"
android:foregroundGravity="top|fill_horizontal" >
<ViewAnimator <ViewAnimator
android:id="@+id/stations_station_details_list_layout" android:id="@+id/stations_station_details_list_layout"
@ -78,8 +80,8 @@
android:id="@+id/stations_station_details_map_fragment" android:id="@+id/stations_station_details_map_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:foreground="@drawable/view_shadow_right" android:elevation="@dimen/elevation_map"
android:foregroundGravity="left|fill_vertical" > tools:targetApi="21">
<de.schildbach.oeffi.OeffiMapView <de.schildbach.oeffi.OeffiMapView
android:id="@+id/stations_station_details_map" android:id="@+id/stations_station_details_map"

View file

@ -44,6 +44,11 @@
<dimen name="layout_navigation_drawer_width">300dp</dimen> <dimen name="layout_navigation_drawer_width">300dp</dimen>
<dimen name="layout_list_width">360dp</dimen> <dimen name="layout_list_width">360dp</dimen>
<dimen name="elevation_map">0dp</dimen>
<dimen name="elevation_content">4dp</dimen>
<dimen name="elevation_panel">6dp</dimen>
<dimen name="elevation_action_bar">8dp</dimen>
<bool name="layout_list_show">true</bool> <bool name="layout_list_show">true</bool>
<bool name="layout_map_show">false</bool> <bool name="layout_map_show">false</bool>
<bool name="layout_navigation_drawer_footer_show">false</bool> <bool name="layout_navigation_drawer_footer_show">false</bool>

View file

@ -201,7 +201,6 @@ public abstract class OeffiMainActivity extends OeffiActivity {
.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); .addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
navigationDrawerListView.setAdapter(menuAdapter); navigationDrawerListView.setAdapter(menuAdapter);
navigationDrawerLayout.setDrawerShadow(R.drawable.view_shadow_right, Gravity.LEFT);
navigationDrawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() { navigationDrawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() {
public void onDrawerOpened(final View drawerView) { public void onDrawerOpened(final View drawerView) {
handler.postDelayed(() -> heartbeat.start(), 2000); handler.postDelayed(() -> heartbeat.start(), 2000);