From f42a1790c5bbf2be1ed71858897d72898e414235 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 25 Apr 2014 16:56:42 -0700 Subject: Apply padding to fragment view rather than ListView This fixes the problem of pinned headers being hidden by the actionbar. Change-Id: Ieeeee69ab596f2c0cc167dcc70c3928a5fef782d --- src/com/android/dialer/DialtactsActivity.java | 4 ++-- src/com/android/dialer/list/SearchFragment.java | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 1b4002cd1..2e0225a37 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -596,7 +596,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O fragment = mRegularSearchFragment; } if (fragment != null && fragment.isVisible()) { - fragment.getListView().animate().translationY(-mActionBarHeight) + fragment.getView().animate().translationY(-mActionBarHeight) .setInterpolator(hideActionBarInterpolator).setDuration(ANIMATION_DURATION); } @@ -622,7 +622,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O fragment = mRegularSearchFragment; } if (fragment != null && fragment.isVisible()) { - fragment.getListView().animate().translationY(0) + fragment.getView().animate().translationY(0) .setInterpolator(showActionBarInterpolator).setDuration(ANIMATION_DURATION); } diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index c4fac695a..f1cd5aacd 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -18,6 +18,7 @@ package com.android.dialer.list; import android.app.Activity; import android.content.Intent; import android.text.TextUtils; +import android.view.View; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.ListView; @@ -67,13 +68,15 @@ public class SearchFragment extends PhoneNumberPickerFragment { } mActionBarHeight = ((DialtactsActivity) getActivity()).getActionBarHeight(); - final ListView listView = getListView(); - listView.setPaddingRelative( - listView.getPaddingStart(), + + final View parentView = getView(); + parentView.setPaddingRelative( + parentView.getPaddingStart(), mActionBarHeight, - listView.getPaddingEnd(), - listView.getPaddingBottom()); - listView.setClipToPadding(false); + parentView.getPaddingEnd(), + parentView.getPaddingBottom()); + + final ListView listView = getListView(); listView.setOnScrollListener(new OnScrollListener() { @Override @@ -88,7 +91,7 @@ public class SearchFragment extends PhoneNumberPickerFragment { }); if (!getActivity().getActionBar().isShowing()) { - listView.setTranslationY(-mActionBarHeight); + parentView.setTranslationY(-mActionBarHeight); } } -- cgit v1.2.3