From 4144a8fa37856a339c52f0fa52246b88755656ad Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Fri, 2 Feb 2018 15:25:37 -0800 Subject: Implemented multiselect in NUI for VisualVoicemailFragment. This solution has a couple hacks in it because the DialtactsActivity has a non-support ActionBar and MainActivity has a support Toolbar. When multiselect is implemented for NewVoicemailFragment, we should be careful to use support action mode instead of non-support action mode so that the transitions and styling are seamless and consistent. Bug: 72722083 Test: manual PiperOrigin-RevId: 184343414 Change-Id: Id16652de2d0add7b7c304d1cedb429fe9b1cf338 --- .../dialer/main/impl/OldMainActivityPeer.java | 28 +++++++++++++++------- .../android/dialer/main/impl/res/values/styles.xml | 16 +++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index 489de1a64..c7410d541 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -30,6 +30,7 @@ import android.provider.CallLog.Calls; import android.provider.ContactsContract.QuickContact; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; +import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.ImageView; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; @@ -159,7 +160,8 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen bottomNav.addOnTabSelectedListener(bottomNavTabListener); callLogFragmentListener = - new MainCallLogFragmentListener(mainActivity, mainActivity.getContentResolver(), bottomNav); + new MainCallLogFragmentListener( + mainActivity, mainActivity.getContentResolver(), bottomNav, toolbar); bottomNav.addOnTabSelectedListener(callLogFragmentListener); searchController = new MainSearchController(mainActivity, bottomNav, fab, toolbar); @@ -388,16 +390,20 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen } /** @see CallLogAdapter.OnActionModeStateChangedListener */ - // TODO(a bug): handle multiselect mode + // TODO(calderwoodra): What is the purpose of this listener? private static final class MainCallLogAdapterOnActionModeStateChangedListener implements CallLogAdapter.OnActionModeStateChangedListener { + private boolean isEnabled; + @Override - public void onActionModeStateChanged(boolean isEnabled) {} + public void onActionModeStateChanged(boolean isEnabled) { + this.isEnabled = isEnabled; + } @Override public boolean isActionModeStateEnabled() { - return false; + return isEnabled; } } @@ -458,18 +464,23 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen OnBottomNavTabSelectedListener { private final CallLogQueryHandler callLogQueryHandler; - private final BottomNavBar bottomNavBar; private final Context context; + private final BottomNavBar bottomNavBar; + private final Toolbar toolbar; private @TabIndex int currentTab = TabIndex.SPEED_DIAL; private long timeSelected = -1; private boolean activityIsAlive; MainCallLogFragmentListener( - Context context, ContentResolver contentResolver, BottomNavBar bottomNavBar) { + Context context, + ContentResolver contentResolver, + BottomNavBar bottomNavBar, + Toolbar toolbar) { callLogQueryHandler = new CallLogQueryHandler(context, contentResolver, this); - this.bottomNavBar = bottomNavBar; this.context = context; + this.bottomNavBar = bottomNavBar; + this.toolbar = toolbar; } @Override @@ -480,7 +491,8 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void showMultiSelectRemoveView(boolean show) { - // TODO(a bug): handle multiselect mode + bottomNavBar.setVisibility(show ? View.GONE : View.VISIBLE); + toolbar.setVisibility(show ? View.GONE : View.VISIBLE); } @Override diff --git a/java/com/android/dialer/main/impl/res/values/styles.xml b/java/com/android/dialer/main/impl/res/values/styles.xml index 26f880dc4..2865f2587 100644 --- a/java/com/android/dialer/main/impl/res/values/styles.xml +++ b/java/com/android/dialer/main/impl/res/values/styles.xml @@ -22,5 +22,21 @@ @style/Dialpad.Light + + + + @style/ActionModeStyle + @style/ThemeOverlay.AppCompat.Dark.ActionBar + + + + + + + -- cgit v1.2.3