Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class ScalingLayout extends FrameLayout {
/**
* CustomOutline for elevation shadows
*/
@Nullable
private ScalingLayoutOutlineProvider viewOutline;


Expand Down Expand Up @@ -153,7 +154,9 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
settings.initialize(w, h);
currentWidth = w;
currentRadius = settings.getMaxRadius();
viewOutline = new ScalingLayoutOutlineProvider(w, h, currentRadius);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
viewOutline = new ScalingLayoutOutlineProvider(w, h, currentRadius);
}
}

rectF.set(0, 0, w, h);
Expand Down Expand Up @@ -232,11 +235,11 @@ public void setListener(ScalingLayoutListener scalingLayoutListener) {
* @param radius
*/
private void updateViewOutline(int height, int width, float radius) {
viewOutline.setHeight(height);
viewOutline.setWidth(width);
viewOutline.setRadius(radius);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && ViewCompat.getElevation(this) > 0f) {
try {
viewOutline.setHeight(height);
viewOutline.setWidth(width);
viewOutline.setRadius(radius);
setOutlineProvider(viewOutline);
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package iammert.com.view.scalinglib;

import android.graphics.Outline;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.view.View;
import android.view.ViewOutlineProvider;

/**
* Created by mertsimsek on 08/01/2018.
*/
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class ScalingLayoutOutlineProvider extends ViewOutlineProvider {

private int width;
Expand Down