diff options
Diffstat (limited to 'java/com/android/contacts/common/list/ViewPagerTabs.java')
-rw-r--r-- | java/com/android/contacts/common/list/ViewPagerTabs.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/java/com/android/contacts/common/list/ViewPagerTabs.java b/java/com/android/contacts/common/list/ViewPagerTabs.java index 1e6cf1354..34f623ef4 100644 --- a/java/com/android/contacts/common/list/ViewPagerTabs.java +++ b/java/com/android/contacts/common/list/ViewPagerTabs.java @@ -33,6 +33,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.android.contacts.common.R; +import com.android.dialer.compat.CompatUtils; /** * Lightweight implementation of ViewPager tabs. This looks similar to traditional actionBar tabs, @@ -42,13 +43,7 @@ import com.android.contacts.common.R; */ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnPageChangeListener { - private static final ViewOutlineProvider VIEW_BOUNDS_OUTLINE_PROVIDER = - new ViewOutlineProvider() { - @Override - public void getOutline(View view, Outline outline) { - outline.setRect(0, 0, view.getWidth(), view.getHeight()); - } - }; + private static final ViewOutlineProvider VIEW_BOUNDS_OUTLINE_PROVIDER; private static final int TAB_SIDE_PADDING_IN_DPS = 10; // TODO: This should use <declare-styleable> in the future private static final int[] ATTRS = @@ -59,6 +54,20 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP android.R.attr.textAllCaps }; + static { + if (CompatUtils.isLollipopCompatible()) { + VIEW_BOUNDS_OUTLINE_PROVIDER = + new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRect(0, 0, view.getWidth(), view.getHeight()); + } + }; + } else { + VIEW_BOUNDS_OUTLINE_PROVIDER = null; + } + } + /** * Linearlayout that will contain the TextViews serving as tabs. This is the only child of the * parent HorizontalScrollView. @@ -102,8 +111,10 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); a.recycle(); - // enable shadow casting from view bounds - setOutlineProvider(VIEW_BOUNDS_OUTLINE_PROVIDER); + if (CompatUtils.isLollipopCompatible()) { + // enable shadow casting from view bounds + setOutlineProvider(VIEW_BOUNDS_OUTLINE_PROVIDER); + } } public void setViewPager(ViewPager viewPager) { |