diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-11-30 18:51:39 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-01-07 23:16:01 +0100 |
commit | 6eca85b409e587bbee2b4754eb4ab1f9571c87b2 (patch) | |
tree | 6f9cacc3336aaffbb71376304e7e96e5f57c6f22 | |
parent | c1d4c7129c7e72eed0436ebd98600332335b2a66 (diff) | |
download | AntennaPod-6eca85b409e587bbee2b4754eb4ab1f9571c87b2.zip |
Shadows
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java | 13 | ||||
-rw-r--r-- | app/src/main/res/drawable/shadow.xml | 7 | ||||
-rw-r--r-- | app/src/main/res/layout/main.xml | 12 |
3 files changed, 27 insertions, 5 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index b65d93b90..17cd5ace3 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -15,11 +15,12 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; +import android.util.TypedValue; import android.view.ContextMenu; import android.view.MenuInflater; import android.view.MenuItem; @@ -70,7 +71,7 @@ import rx.schedulers.Schedulers; /** * The activity that is shown when the user launches the app. */ -public class MainActivity extends ActionBarActivity implements NavDrawerActivity { +public class MainActivity extends AppCompatActivity implements NavDrawerActivity { private static final String TAG = "MainActivity"; @@ -124,7 +125,13 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - getSupportActionBar().setElevation(3.0f); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + findViewById(R.id.shadow).setVisibility(View.GONE); + int elevation = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, + getResources().getDisplayMetrics()); + getSupportActionBar().setElevation(elevation); + } currentTitle = getTitle(); diff --git a/app/src/main/res/drawable/shadow.xml b/app/src/main/res/drawable/shadow.xml new file mode 100644 index 000000000..fc5110e0b --- /dev/null +++ b/app/src/main/res/drawable/shadow.xml @@ -0,0 +1,7 @@ +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:startColor="@android:color/transparent" + android:endColor="#40000000" + android:angle="90" /> +</shape> diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml index 46be5bc5f..c05132b42 100644 --- a/app/src/main/res/layout/main.xml +++ b/app/src/main/res/layout/main.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" +<android.support.v4.widget.DrawerLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" @@ -10,7 +11,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <FrameLayout android:id="@+id/playerFragment" android:layout_width="match_parent" @@ -27,6 +27,14 @@ android:background="?attr/colorPrimary" android:minHeight="?attr/actionBarSize" tools:background="@android:color/holo_blue_dark" /> + + <View + android:id="@+id/shadow" + android:layout_width="match_parent" + android:layout_height="4dp" + android:layout_below="@id/toolbar" + android:background="@drawable/shadow" /> + <FrameLayout android:id="@+id/main_view" android:layout_width="match_parent" |