package com.scb.phone.view.custom.common; import android.content.Context; import android.util.AttributeSet; import android.view.View; import androidx.viewpager.widget.ViewPager; import o.guQ; /* loaded from: classes5.dex */ public class RealWrapContentViewPager extends NonSwipeableViewPager { private ViewPager.ojQ c; public RealWrapContentViewPager(Context context) { super(context); } public RealWrapContentViewPager(Context context, AttributeSet attributeSet) { super(context, attributeSet); } @Override // androidx.viewpager.widget.ViewPager, android.view.View public void onMeasure(int i, int i2) { try { View childAt = getChildAt(getCurrentItem()); if (childAt != null) { childAt.measure(i, i2); setMeasuredDimension(getDefaultSize(0, i), childAt.getMeasuredHeight()); return; } super.onMeasure(i, i2); } catch (Exception e) { guQ.e(e, "WrapContentViewPager onMeasureException", new Object[0]); super.onMeasure(i, i2); } } @Override // androidx.viewpager.widget.ViewPager, android.view.ViewGroup, android.view.View public void onAttachedToWindow() { super.onAttachedToWindow(); ViewPager.jbe jbeVar = new ViewPager.jbe(this) { // from class: com.scb.phone.view.custom.common.RealWrapContentViewPager.3 private RealWrapContentViewPager c; { this.c = this; } @Override // androidx.viewpager.widget.ViewPager.jbe, androidx.viewpager.widget.ViewPager.ojQ public final void onPageSelected(int i) { this.c.requestLayout(); } }; this.c = jbeVar; addOnPageChangeListener(jbeVar); } @Override // androidx.viewpager.widget.ViewPager, android.view.ViewGroup, android.view.View public void onDetachedFromWindow() { removeOnPageChangeListener(this.c); this.c = null; super.onDetachedFromWindow(); } }