summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-02-02 15:25:37 -0800
committerCopybara-Service <copybara-piper@google.com>2018-02-02 17:26:03 -0800
commit4144a8fa37856a339c52f0fa52246b88755656ad (patch)
tree773966fcdd18e4cdbae8ffeb76342750f3fa55ff
parenta0bd92e4873b22353d96b0752a29562fd243634e (diff)
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
-rw-r--r--java/com/android/dialer/main/impl/OldMainActivityPeer.java28
-rw-r--r--java/com/android/dialer/main/impl/res/values/styles.xml16
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 @@
<!-- Theme needed for DialpadFragment -->
<item name="dialpad_style">@style/Dialpad.Light</item>
+
+ <!-- Required for actionmode/multiselect to render properly. -->
+ <!-- TODO(calderwoodra): Check to see if we can remove this after NewVoicemailFragment launches -->
+ <item name="actionModeStyle">@style/ActionModeStyle</item>
+ <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
+ </style>
+
+ <!-- Colors our actionbar in action mode to dialer theme color. -->
+ <style name="ActionModeStyle" parent="@style/Widget.AppCompat.ActionMode">
+ <item name="background">@color/dialer_theme_color</item>
+ <item name="titleTextStyle">@style/ActionModeTitleTextStyle</item>
+ </style>
+
+ <!-- Colors our actionbar text in action mode to dialer white text color. -->
+ <style name="ActionModeTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionMode.Title">
+ <item name="android:textColor">@color/dialer_primary_text_color_white</item>
</style>
</resources>