Skip to content

Commit 03d7b1e

Browse files
committed
Merge remote-tracking branch 'hrskrs/master'
2 parents 8ff0d4e + 94a73cf commit 03d7b1e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/src/main/java/com/soundcloud/android/crop/CropImageView.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.Context;
44
import android.graphics.Canvas;
55
import android.graphics.Rect;
6+
import android.os.Build;
67
import android.support.annotation.NonNull;
78
import android.util.AttributeSet;
89
import android.view.MotionEvent;
@@ -20,6 +21,8 @@ public class CropImageView extends ImageViewTouchBase {
2021
private int motionEdge;
2122
private int validPointerId;
2223

24+
private int softNavbarHeight = 0;
25+
2326
public CropImageView(Context context) {
2427
super(context);
2528
}
@@ -35,6 +38,14 @@ public CropImageView(Context context, AttributeSet attrs, int defStyle) {
3538
@Override
3639
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
3740
super.onLayout(changed, left, top, right, bottom);
41+
42+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
43+
int resID = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
44+
if(resID > 0){
45+
softNavbarHeight = getResources().getDimensionPixelSize(resID);
46+
}
47+
}
48+
3849
if (bitmapDisplayed.getBitmap() != null) {
3950
for (HighlightView hv : highlightViews) {
4051

@@ -143,7 +154,7 @@ private void ensureVisible(HighlightView hv) {
143154
int panDeltaX2 = Math.min(0, getRight() - r.right);
144155

145156
int panDeltaY1 = Math.max(0, getTop() - r.top);
146-
int panDeltaY2 = Math.min(0, getBottom() - r.bottom);
157+
int panDeltaY2 = Math.min(0, getBottom() - r.bottom - softNavbarHeight);
147158

148159
int panDeltaX = panDeltaX1 != 0 ? panDeltaX1 : panDeltaX2;
149160
int panDeltaY = panDeltaY1 != 0 ? panDeltaY1 : panDeltaY2;

0 commit comments

Comments
 (0)