From 3f4a31982fc815b1620671f16f7d45a8d2c07988 Mon Sep 17 00:00:00 2001 From: Android Dialer Date: Wed, 20 Sep 2017 17:59:44 -0700 Subject: Dialer integration of contacts suggestions promo Illustration icon TBD https://photos.app.goo.gl/ZDLNLlXg9VBKNHGx1 Manual testing of duplicates promo end to end flow accept/dismiss states Bug: 64491095 Test: http://sponge/db7bd5c3-ec97-46c8-a058-ed7f46a5e4ce PiperOrigin-RevId: 169480950 Change-Id: Ia553e87ce72d84a001769851abb925da1ab31756 --- java/com/android/dialer/app/DialtactsActivity.java | 12 ++++++++++++ .../com/android/dialer/app/res/layout/dialtacts_activity.xml | 1 + .../android/dialer/contactsfragment/ContactsFragment.java | 9 +++++++++ .../dialer/contactsfragment/res/layout/fragment_contacts.xml | 4 +++- 4 files changed, 25 insertions(+), 1 deletion(-) (limited to 'java') diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index 74bf98dae..02e0896aa 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -100,6 +100,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.constants.ActivityRequestCodes; +import com.android.dialer.contactsfragment.ContactsFragment; import com.android.dialer.database.Database; import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.dialpadview.DialpadFragment; @@ -146,6 +147,7 @@ public class DialtactsActivity extends TransactionSafeActivity OnListFragmentScrolledListener, CallLogFragment.HostInterface, CallLogAdapter.OnActionModeStateChangedListener, + ContactsFragment.OnContactsListScrolledListener, DialpadFragment.HostInterface, OldSpeedDialFragment.HostInterface, SearchFragment.HostInterface, @@ -191,6 +193,7 @@ public class DialtactsActivity extends TransactionSafeActivity /** Fragment containing the dialpad that slides into view */ protected DialpadFragment mDialpadFragment; + /** Root layout of DialtactsActivity */ private CoordinatorLayout mParentLayout; /** Fragment for searching phone numbers using the alphanumeric keyboard. */ private RegularSearchFragment mRegularSearchFragment; @@ -693,6 +696,10 @@ public class DialtactsActivity extends TransactionSafeActivity startActivity(intent); } + public boolean inAllContactsTab() { + return mListsFragment.getCurrentTabIndex() == DialtactsPagerAdapter.TAB_INDEX_ALL_CONTACTS; + } + @Override public void onClick(View view) { int resId = view.getId(); @@ -881,6 +888,11 @@ public class DialtactsActivity extends TransactionSafeActivity exitSearchUi(); } + @Override + public void onContactsListScrolled(int scrollState) { + // intentionally empty. + } + /** * Initiates animations and other visual updates to hide the dialpad. The fragment is hidden in a * callback after the hide animation ends. diff --git a/java/com/android/dialer/app/res/layout/dialtacts_activity.xml b/java/com/android/dialer/app/res/layout/dialtacts_activity.xml index 958b6944b..4c07f1c9e 100644 --- a/java/com/android/dialer/app/res/layout/dialtacts_activity.xml +++ b/java/com/android/dialer/app/res/layout/dialtacts_activity.xml @@ -21,6 +21,7 @@ android:layout_height="match_parent" android:background="@color/background_dialer_light" android:clipChildren="false" + android:clipToPadding="false" android:focusable="true" android:focusableInTouchMode="true" android:orientation="vertical"> diff --git a/java/com/android/dialer/contactsfragment/ContactsFragment.java b/java/com/android/dialer/contactsfragment/ContactsFragment.java index 7d2097692..6aa91575f 100644 --- a/java/com/android/dialer/contactsfragment/ContactsFragment.java +++ b/java/com/android/dialer/contactsfragment/ContactsFragment.java @@ -38,6 +38,7 @@ import android.widget.TextView; import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.preference.ContactsPreferences.ChangeListener; import com.android.dialer.common.Assert; +import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.performancereport.PerformanceReport; import com.android.dialer.util.DialerUtils; @@ -90,6 +91,11 @@ public class ContactsFragment extends Fragment private @Header int header; private @ClickAction int clickAction; + /** Listener for contacts list scroll state. */ + public interface OnContactsListScrolledListener { + void onContactsListScrolled(int scrollState); + } + /** * Used to get a configured instance of ContactsFragment. * @@ -239,6 +245,9 @@ public class ContactsFragment extends Fragment } String anchoredHeaderString = adapter.getHeaderString(firstCompletelyVisible); + FragmentUtils.getParentUnsafe(this, OnContactsListScrolledListener.class) + .onContactsListScrolled(recyclerView.getScrollState()); + // If the user swipes to the top of the list very quickly, there is some strange behavior // between this method updating headers and adapter#onBindViewHolder updating headers. // To overcome this, we refresh the headers to ensure they are correct. diff --git a/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml b/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml index 3d58aad0d..7bc3b34a5 100644 --- a/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml +++ b/java/com/android/dialer/contactsfragment/res/layout/fragment_contacts.xml @@ -23,7 +23,9 @@ android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background_dialer_light"/> + android:background="@color/background_dialer_light" + android:paddingBottom="@dimen/floating_action_button_list_bottom_padding" + android:clipToPadding="false"/> -- cgit v1.2.3