Skip to content

Commit 57bbd00

Browse files
committed
Added actionbar shadow hardware acceleration support for devices >= Pie
1 parent ce9b8e3 commit 57bbd00

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/src/main/java/com/homesoft/bitmap2video/MainActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ private static float getFloat(final Resources res, int id) {
9696

9797

9898
private void createActionBarBorder(final Toolbar toolbar) {
99+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
100+
//This is not awesome, but shadowLayer is not supported by hardware acceleration before Pie
101+
toolbar.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
102+
}
99103
final Resources res = getResources();
100104
final PathRoundedRectShape shape = new PathRoundedRectShape();
101105
shape.setCornerRadius(res.getDimension(R.dimen.actionBarCornerRadius));
@@ -111,6 +115,7 @@ private void createActionBarBorder(final Toolbar toolbar) {
111115
res.getColor(R.color.actionBarShadowColor));
112116
toolbar.setBackground(insetDrawable);
113117
}
118+
114119
void done() {
115120
runOnUiThread(new Runnable() {
116121
@Override

app/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
android:id="@+id/toolbar"
1010
android:layout_width="match_parent"
1111
android:layout_height="wrap_content"
12-
android:layerType="software"
1312
/>
1413
<RadioGroup
1514
android:id="@+id/codec"

0 commit comments

Comments
 (0)