diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-02-15 18:08:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-02-15 18:08:21 +0000 |
commit | c54ce2658988ca36ca3dfab00daefca4dcfed3b2 (patch) | |
tree | fb432a423f670969da57a4900b5ff7dcc35d2f8c /java/com/android/dialer/main/impl | |
parent | 70f98d3997c42c7d4e3b3e3920659aca78820d14 (diff) | |
parent | 39009b4ad73d5017295b30fb18a77224195f06af (diff) |
Merge changes Ib360d3bc,Iae40d0ab,I486f7b1a,I709a1e30
* changes:
Mark calls as read in new call log.
Restored work profile contacts to Dialer search.
Clicking on a missed call in the call log no longer crashes the app.
Add bottom sheet options for blocked and/or spam numbers in the new call log.
Diffstat (limited to 'java/com/android/dialer/main/impl')
-rw-r--r-- | java/com/android/dialer/main/impl/NewMainActivityPeer.java | 28 | ||||
-rw-r--r-- | java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java | 1 |
2 files changed, 25 insertions, 4 deletions
diff --git a/java/com/android/dialer/main/impl/NewMainActivityPeer.java b/java/com/android/dialer/main/impl/NewMainActivityPeer.java index 789648928..0a85667a1 100644 --- a/java/com/android/dialer/main/impl/NewMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/NewMainActivityPeer.java @@ -16,16 +16,22 @@ package com.android.dialer.main.impl; +import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; +import com.android.dialer.calllog.CallLogComponent; import com.android.dialer.calllog.ui.NewCallLogFragment; +import com.android.dialer.common.concurrent.DefaultFutureCallback; import com.android.dialer.main.MainActivityPeer; import com.android.dialer.main.impl.bottomnav.BottomNavBar; import com.android.dialer.main.impl.bottomnav.BottomNavBar.OnBottomNavTabSelectedListener; import com.android.dialer.main.impl.bottomnav.BottomNavBar.TabIndex; import com.android.dialer.voicemail.listui.NewVoicemailFragment; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.MoreExecutors; /** MainActivityPeer that implements the new fragments. */ public class NewMainActivityPeer implements MainActivityPeer { @@ -40,7 +46,8 @@ public class NewMainActivityPeer implements MainActivityPeer { public void onActivityCreate(Bundle saveInstanceState) { mainActivity.setContentView(R.layout.main_activity); MainBottomNavBarBottomNavTabListener bottomNavBarBottomNavTabListener = - new MainBottomNavBarBottomNavTabListener(mainActivity.getSupportFragmentManager()); + new MainBottomNavBarBottomNavTabListener( + mainActivity.getSupportFragmentManager(), mainActivity.getApplicationContext()); BottomNavBar bottomNav = mainActivity.findViewById(R.id.bottom_nav_bar); bottomNav.addOnTabSelectedListener(bottomNavBarBottomNavTabListener); bottomNav.selectTab(TabIndex.SPEED_DIAL); @@ -77,9 +84,12 @@ public class NewMainActivityPeer implements MainActivityPeer { private static final String VOICEMAIL_TAG = "voicemail"; private final FragmentManager supportFragmentManager; + private final Context appContext; - private MainBottomNavBarBottomNavTabListener(FragmentManager supportFragmentManager) { + private MainBottomNavBarBottomNavTabListener( + FragmentManager supportFragmentManager, Context appContext) { this.supportFragmentManager = supportFragmentManager; + this.appContext = appContext; } @Override @@ -126,8 +136,18 @@ public class NewMainActivityPeer implements MainActivityPeer { private void hideAllFragments() { FragmentTransaction supportTransaction = supportFragmentManager.beginTransaction(); - if (supportFragmentManager.findFragmentByTag(CALL_LOG_TAG) != null) { - supportTransaction.hide(supportFragmentManager.findFragmentByTag(CALL_LOG_TAG)); + Fragment callLogFragment = supportFragmentManager.findFragmentByTag(CALL_LOG_TAG); + if (callLogFragment != null) { + if (callLogFragment.isVisible()) { + // If the user taps any bottom nav button and the call log is showing, immediately cancel + // missed calls (unbold them and clear their notifications). + Futures.addCallback( + // TODO(zachh): Use dagger to create Peer and MainBottomNavBarBottomNavTabListener. + CallLogComponent.get(appContext).getClearMissedCalls().clearAll(), + new DefaultFutureCallback<>(), + MoreExecutors.directExecutor()); + } + supportTransaction.hide(callLogFragment); } if (supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG) != null) { supportTransaction.hide(supportFragmentManager.findFragmentByTag(VOICEMAIL_TAG)); diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java index a580aee68..2945e39a9 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java @@ -162,6 +162,7 @@ public final class BottomNavBar extends LinearLayout { } } + @TabIndex public int getSelectedTab() { return selectedTab; } |