From 5b99e36d5139a4e6b141af45f4cbcd946d81675e Mon Sep 17 00:00:00 2001 From: yueg Date: Thu, 28 Jun 2018 14:26:45 -0700 Subject: Fix scroll for new favorites Test: SpeedDialAdapterTest PiperOrigin-RevId: 202543795 Change-Id: I1eec7a7328da3037b4d1cbacc7d9b211305e3eb0 --- .../dialer/main/impl/OldMainActivityPeer.java | 29 +++++++++++++++++++--- .../dialer/main/impl/res/layout/main_activity.xml | 14 +++-------- .../android/dialer/speeddial/SpeedDialAdapter.java | 8 +++++- .../dialer/speeddial/SpeedDialFragment.java | 9 ++++++- .../speeddial/res/layout/fragment_speed_dial.xml | 4 +-- 5 files changed, 46 insertions(+), 18 deletions(-) (limited to 'java/com') diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index d790c6814..73bb4f81a 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -51,6 +51,7 @@ import android.text.method.LinkMovementMethod; import android.view.ActionMode; import android.view.DragEvent; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; @@ -334,7 +335,12 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen activity.findViewById(R.id.remove_view), activity.findViewById(R.id.search_view_container), toolbar); - speedDialFragmentHost = new MainSpeedDialFragmentHost(toolbar); + speedDialFragmentHost = + new MainSpeedDialFragmentHost( + toolbar, + activity.findViewById(R.id.root_layout), + activity.findViewById(R.id.coordinator_layout), + activity.findViewById(R.id.fragment_container)); lastTabController = new LastTabController(activity, bottomNav, showVoicemailTab); @@ -1255,15 +1261,32 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen private static final class MainSpeedDialFragmentHost implements SpeedDialFragment.HostInterface { private final MainToolbar toolbar; - - MainSpeedDialFragmentHost(MainToolbar toolbar) { + private final ViewGroup rootLayout; + private final ViewGroup coordinatorLayout; + private final ViewGroup fragmentContainer; + + MainSpeedDialFragmentHost( + MainToolbar toolbar, + ViewGroup rootLayout, + ViewGroup coordinatorLayout, + ViewGroup fragmentContainer) { this.toolbar = toolbar; + this.rootLayout = rootLayout; + this.coordinatorLayout = coordinatorLayout; + this.fragmentContainer = fragmentContainer; } @Override public void setHasFrequents(boolean hasFrequents) { toolbar.showClearFrequents(hasFrequents); } + + @Override + public void dragFavorite(boolean start) { + rootLayout.setClipChildren(!start); + coordinatorLayout.setClipChildren(!start); + fragmentContainer.setClipChildren(!start); + } } /** diff --git a/java/com/android/dialer/main/impl/res/layout/main_activity.xml b/java/com/android/dialer/main/impl/res/layout/main_activity.xml index 76d709c16..5fd9bed7b 100644 --- a/java/com/android/dialer/main/impl/res/layout/main_activity.xml +++ b/java/com/android/dialer/main/impl/res/layout/main_activity.xml @@ -19,9 +19,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/root_layout" android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipChildren="false" - android:clipToPadding="false"> + android:layout_height="match_parent"> + android:layout_above="@+id/bottom_nav_bar"> + android:layout_height="match_parent"/> - \ No newline at end of file + diff --git a/java/com/android/dialer/speeddial/SpeedDialAdapter.java b/java/com/android/dialer/speeddial/SpeedDialAdapter.java index ff52a0745..4a48b6504 100644 --- a/java/com/android/dialer/speeddial/SpeedDialAdapter.java +++ b/java/com/android/dialer/speeddial/SpeedDialAdapter.java @@ -34,6 +34,7 @@ import android.widget.FrameLayout; import com.android.dialer.common.Assert; import com.android.dialer.speeddial.FavoritesViewHolder.FavoriteContactsListener; import com.android.dialer.speeddial.HeaderViewHolder.SpeedDialHeaderListener; +import com.android.dialer.speeddial.SpeedDialFragment.HostInterface; import com.android.dialer.speeddial.SuggestionViewHolder.SuggestedContactsListener; import com.android.dialer.speeddial.draghelper.SpeedDialItemTouchHelperCallback.ItemTouchHelperAdapter; import com.android.dialer.speeddial.loader.SpeedDialUiItem; @@ -81,6 +82,7 @@ public final class SpeedDialAdapter extends RecyclerView.Adapter positionToRowTypeMap = new ArrayMap<>(); private List speedDialUiItems; @@ -95,11 +97,13 @@ public final class SpeedDialAdapter extends RecyclerView.Adapter + android:layout_height="match_parent">