diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-27 02:09:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-27 02:09:42 +0000 |
commit | add7d143419d8ada612eb3e0bb2807b0e97dff35 (patch) | |
tree | b49fe3352268663ae05c447f0f088ccdc9df585b /java/com/android/dialer/main/impl | |
parent | e5f1e62682bec9f7bfa019b1820328fe98fa45bf (diff) | |
parent | 26f520249eccdcf2352806ba8d6a54bb8e5045a6 (diff) |
Merge changes I4bdadacc,Ie1f8da1a
* changes:
Reworked the internals of DialerPhoneNumber.
Implemented Post Call in NUI.
Diffstat (limited to 'java/com/android/dialer/main/impl')
3 files changed, 52 insertions, 31 deletions
diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index 3edf6c6af..a7a9e6c5a 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -25,6 +25,7 @@ import android.provider.ContactsContract.QuickContact; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; +import android.view.View; import android.widget.ImageView; import com.android.dialer.calllog.ui.NewCallLogFragment; import com.android.dialer.common.LogUtil; @@ -41,9 +42,11 @@ import com.android.dialer.dialpadview.DialpadFragment.LastOutgoingCallCallback; import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener; import com.android.dialer.main.impl.BottomNavBar.OnBottomNavTabSelectedListener; import com.android.dialer.main.impl.toolbar.MainToolbar; +import com.android.dialer.postcall.PostCall; import com.android.dialer.searchfragment.list.NewSearchFragment.SearchFragmentListener; import com.android.dialer.smartdial.util.SmartDialPrefix; import com.android.dialer.speeddial.SpeedDialFragment; +import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.voicemail.listui.NewVoicemailFragment; /** This is the main activity for dialer. It hosts favorites, call log, search, dialpad, etc... */ @@ -61,6 +64,8 @@ public final class MainActivity extends AppCompatActivity /** Language the device was in last time {@link #onSaveInstanceState(Bundle)} was called. */ private String savedLanguageCode; + private View snackbarContainer; + /** * @param context Context of the application package implementing MainActivity class. * @return intent for MainActivity.class @@ -81,6 +86,8 @@ public final class MainActivity extends AppCompatActivity } private void initLayout(Bundle savedInstanceState) { + snackbarContainer = findViewById(R.id.coordinator_layout); + FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(v -> searchController.showDialpad(true)); @@ -110,6 +117,21 @@ public final class MainActivity extends AppCompatActivity // language change. boolean forceUpdate = !CompatUtils.getLocale(this).getISO3Language().equals(savedLanguageCode); Database.get(this).getDatabaseHelper(this).startSmartDialUpdateThread(forceUpdate); + showPostCallPrompt(); + } + + private void showPostCallPrompt() { + if (TelecomUtil.isInManagedCall(this)) { + // No prompt to show if the user is in a call + return; + } + + if (searchController.isInSearch()) { + // Don't show the prompt if we're in the search ui + return; + } + + PostCall.promptUserForMessageIfNecessary(this, snackbarContainer); } @Override diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index b01f80de6..1defdf578 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -40,7 +40,6 @@ import com.android.dialer.main.impl.toolbar.MainToolbar; import com.android.dialer.main.impl.toolbar.SearchBarListener; import com.android.dialer.searchfragment.list.NewSearchFragment; import com.android.dialer.searchfragment.list.NewSearchFragment.SearchFragmentListener; -import com.android.dialer.util.ViewUtil; import com.google.common.base.Optional; import java.util.ArrayList; @@ -99,7 +98,7 @@ final class MainSearchController implements SearchBarListener { // Show Search if (getSearchFragment() == null) { NewSearchFragment searchFragment = NewSearchFragment.newInstance(false); - transaction.add(R.id.search_fragment_container, searchFragment, SEARCH_FRAGMENT_TAG); + transaction.add(R.id.fragment_container, searchFragment, SEARCH_FRAGMENT_TAG); } else if (!isSearchVisible()) { transaction.show(getSearchFragment()); } @@ -153,17 +152,11 @@ final class MainSearchController implements SearchBarListener { } private void hideBottomNav() { - bottomNav.setVisibility(View.INVISIBLE); - if (bottomNav.getHeight() == 0) { - ViewUtil.doOnGlobalLayout(bottomNav, v -> fab.setTranslationY(bottomNav.getHeight())); - } else { - fab.setTranslationY(bottomNav.getHeight()); - } + bottomNav.setVisibility(View.GONE); } private void showBottomNav() { bottomNav.setVisibility(View.VISIBLE); - fab.setTranslationY(0); } /** Should be called when {@link DialpadListener#onDialpadShown()} is called. */ @@ -255,6 +248,11 @@ final class MainSearchController implements SearchBarListener { return fragment != null && fragment.isAdded() && !fragment.isHidden(); } + /** Returns true if the search UI is visible. */ + public boolean isInSearch() { + return isSearchVisible(); + } + /** * Opens search in regular/search bar search mode. * @@ -276,7 +274,7 @@ final class MainSearchController implements SearchBarListener { // Show Search if (getSearchFragment() == null) { NewSearchFragment searchFragment = NewSearchFragment.newInstance(false); - transaction.add(R.id.search_fragment_container, searchFragment, SEARCH_FRAGMENT_TAG); + transaction.add(R.id.fragment_container, searchFragment, SEARCH_FRAGMENT_TAG); } else if (!isSearchVisible()) { transaction.show(getSearchFragment()); } 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 eb0d45e57..aaba8da77 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 @@ -21,13 +21,31 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <!-- Holds SpeedDial, Call Log, Contacts and Voicemail fragments --> - <FrameLayout - android:id="@+id/fragment_container" + <android.support.design.widget.CoordinatorLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/toolbar" - android:layout_above="@+id/bottom_nav_bar"/> + android:layout_above="@+id/bottom_nav_bar"> + + <!-- Holds SpeedDial, Call Log, Contacts, Voicemail and Search fragments --> + <FrameLayout + android:id="@+id/fragment_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_above="@+id/bottom_nav_bar"/> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:layout_gravity="end|bottom" + android:src="@drawable/quantum_ic_dialpad_white_24" + app:backgroundTint="?android:attr/colorAccent"/> + </android.support.design.widget.CoordinatorLayout> <!-- BottomNavBar --> <include @@ -37,13 +55,6 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true"/> - <!-- Holds search fragment --> - <FrameLayout - android:id="@+id/search_fragment_container" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_below="@+id/toolbar"/> - <!-- Holds Dialpad fragment --> <FrameLayout android:id="@+id/dialpad_fragment_container" @@ -55,14 +66,4 @@ <include android:id="@+id/toolbar" layout="@layout/toolbar_layout"/> - - <android.support.design.widget.FloatingActionButton - android:id="@+id/fab" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_above="@+id/bottom_nav_bar" - android:layout_alignParentEnd="true" - android:layout_margin="16dp" - android:src="@drawable/quantum_ic_dialpad_white_24" - app:backgroundTint="?android:attr/colorAccent"/> </RelativeLayout>
\ No newline at end of file |