Skip to content

Commit

Permalink
bugfix: should call requestApplyInsets when addView is called in QMUI…
Browse files Browse the repository at this point in the history
…ViewPager. #352
  • Loading branch information
cgspine committed Aug 2, 2018
1 parent f579f52 commit 0e16be2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIViewPager.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package com.qmuiteam.qmui.widget;

import android.annotation.TargetApi;
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Rect;
import android.os.Build;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.WindowInsetsCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;

import com.qmuiteam.qmui.util.QMUIWindowInsetHelper;

Expand Down Expand Up @@ -66,6 +64,12 @@ public void setEnableLoop(boolean enableLoop) {

}

@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
ViewCompat.requestApplyInsets(this);
}

@Override
public boolean onTouchEvent(MotionEvent ev) {
return mIsSwipeable && super.onTouchEvent(ev);
Expand Down

0 comments on commit 0e16be2

Please sign in to comment.