Loading java/com/android/dialer/main/impl/MainSearchController.java +33 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.dialer.main.impl; import android.app.Fragment; import android.app.FragmentTransaction; import android.content.ActivityNotFoundException; import android.content.Intent; Loading Loading @@ -131,7 +132,15 @@ public class MainSearchController implements SearchBarListener { transaction.commit(); } /** Hides the dialpad, reveals the FAB and slides the toolbar back onto the screen. */ /** * Hides the dialpad, reveals the FAB and slides the toolbar back onto the screen. * * <p>This method intentionally "hides" and does not "remove" the dialpad in order to preserve its * state (i.e. we call {@link FragmentTransaction#hide(Fragment)} instead of {@link * FragmentTransaction#remove(Fragment)}. * * @see {@link #closeSearch(boolean)} to "remove" the dialpad. */ private void hideDialpad(boolean animate, boolean bottomNavVisible) { Assert.checkArgument(isDialpadVisible()); Loading Loading @@ -159,7 +168,7 @@ public class MainSearchController implements SearchBarListener { @Override public void onAnimationEnd(Animation animation) { if (!(mainActivity.isFinishing() || mainActivity.isDestroyed())) { mainActivity.getFragmentManager().beginTransaction().remove(dialpadFragment).commit(); mainActivity.getFragmentManager().beginTransaction().hide(dialpadFragment).commit(); } } Loading Loading @@ -227,7 +236,10 @@ public class MainSearchController implements SearchBarListener { } } /** Calls {@link #hideDialpad(boolean, boolean)} and removes the search fragment. */ /** * Calls {@link #hideDialpad(boolean, boolean)}, removes the search fragment and clears the * dialpad. */ private void closeSearch(boolean animate) { Assert.checkArgument(isSearchVisible()); if (isDialpadVisible()) { Loading @@ -238,9 +250,17 @@ public class MainSearchController implements SearchBarListener { showBottomNav(); toolbar.collapse(animate); mainActivity.getFragmentManager().beginTransaction().remove(getSearchFragment()).commit(); // Clear the dialpad so the phone number isn't persisted between search sessions. getDialpadFragment().clearDialpad(); } @Nullable /** * Returns {@link DialpadFragment}. * * <p>Unless this method is being called for the first time in {@link #openSearch(Optional)} or * {@link #showDialpad(boolean)}, it should never return null. */ private DialpadFragment getDialpadFragment() { return (DialpadFragment) mainActivity.getFragmentManager().findFragmentByTag(DIALPAD_FRAGMENT_TAG); Loading Loading @@ -295,6 +315,15 @@ public class MainSearchController implements SearchBarListener { } else if (!isSearchVisible()) { transaction.show(getSearchFragment()); } // Add the dialpad fragment but keep it hidden if (getDialpadFragment() == null) { DialpadFragment dialpadFragment = new DialpadFragment(); transaction .add(R.id.dialpad_fragment_container, dialpadFragment, DIALPAD_FRAGMENT_TAG) .hide(dialpadFragment); } transaction.commit(); } Loading java/com/android/dialer/main/impl/res/layout/main_activity.xml +7 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,13 @@ android:id="@+id/toolbar" layout="@layout/toolbar_layout"/> <ImageView android:layout_width="match_parent" android:layout_height="2dp" android:scaleType="fitXY" android:src="@drawable/search_shadow" android:layout_below="@+id/toolbar"/> <!-- TODO(calderwoodra): investigate what this is for and why we want it. --> <!-- Host container for the contact tile drag shadow --> <FrameLayout Loading java/com/android/dialer/main/impl/toolbar/res/drawable/search_shadow.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#3333" android:endColor="#0333" android:type="linear" android:angle="90"> </gradient> </shape> No newline at end of file java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toEndOf="@+id/search_back_button" android:layout_toStartOf="@+id/search_close_button" android:layout_toStartOf="@+id/search_clear_button" android:layout_centerVertical="true" android:layout_marginStart="8dp" android:minHeight="48dp" Loading java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ <com.android.dialer.main.impl.toolbar.MainToolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/dialer_theme_color" Loading Loading
java/com/android/dialer/main/impl/MainSearchController.java +33 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.dialer.main.impl; import android.app.Fragment; import android.app.FragmentTransaction; import android.content.ActivityNotFoundException; import android.content.Intent; Loading Loading @@ -131,7 +132,15 @@ public class MainSearchController implements SearchBarListener { transaction.commit(); } /** Hides the dialpad, reveals the FAB and slides the toolbar back onto the screen. */ /** * Hides the dialpad, reveals the FAB and slides the toolbar back onto the screen. * * <p>This method intentionally "hides" and does not "remove" the dialpad in order to preserve its * state (i.e. we call {@link FragmentTransaction#hide(Fragment)} instead of {@link * FragmentTransaction#remove(Fragment)}. * * @see {@link #closeSearch(boolean)} to "remove" the dialpad. */ private void hideDialpad(boolean animate, boolean bottomNavVisible) { Assert.checkArgument(isDialpadVisible()); Loading Loading @@ -159,7 +168,7 @@ public class MainSearchController implements SearchBarListener { @Override public void onAnimationEnd(Animation animation) { if (!(mainActivity.isFinishing() || mainActivity.isDestroyed())) { mainActivity.getFragmentManager().beginTransaction().remove(dialpadFragment).commit(); mainActivity.getFragmentManager().beginTransaction().hide(dialpadFragment).commit(); } } Loading Loading @@ -227,7 +236,10 @@ public class MainSearchController implements SearchBarListener { } } /** Calls {@link #hideDialpad(boolean, boolean)} and removes the search fragment. */ /** * Calls {@link #hideDialpad(boolean, boolean)}, removes the search fragment and clears the * dialpad. */ private void closeSearch(boolean animate) { Assert.checkArgument(isSearchVisible()); if (isDialpadVisible()) { Loading @@ -238,9 +250,17 @@ public class MainSearchController implements SearchBarListener { showBottomNav(); toolbar.collapse(animate); mainActivity.getFragmentManager().beginTransaction().remove(getSearchFragment()).commit(); // Clear the dialpad so the phone number isn't persisted between search sessions. getDialpadFragment().clearDialpad(); } @Nullable /** * Returns {@link DialpadFragment}. * * <p>Unless this method is being called for the first time in {@link #openSearch(Optional)} or * {@link #showDialpad(boolean)}, it should never return null. */ private DialpadFragment getDialpadFragment() { return (DialpadFragment) mainActivity.getFragmentManager().findFragmentByTag(DIALPAD_FRAGMENT_TAG); Loading Loading @@ -295,6 +315,15 @@ public class MainSearchController implements SearchBarListener { } else if (!isSearchVisible()) { transaction.show(getSearchFragment()); } // Add the dialpad fragment but keep it hidden if (getDialpadFragment() == null) { DialpadFragment dialpadFragment = new DialpadFragment(); transaction .add(R.id.dialpad_fragment_container, dialpadFragment, DIALPAD_FRAGMENT_TAG) .hide(dialpadFragment); } transaction.commit(); } Loading
java/com/android/dialer/main/impl/res/layout/main_activity.xml +7 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,13 @@ android:id="@+id/toolbar" layout="@layout/toolbar_layout"/> <ImageView android:layout_width="match_parent" android:layout_height="2dp" android:scaleType="fitXY" android:src="@drawable/search_shadow" android:layout_below="@+id/toolbar"/> <!-- TODO(calderwoodra): investigate what this is for and why we want it. --> <!-- Host container for the contact tile drag shadow --> <FrameLayout Loading
java/com/android/dialer/main/impl/toolbar/res/drawable/search_shadow.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#3333" android:endColor="#0333" android:type="linear" android:angle="90"> </gradient> </shape> No newline at end of file
java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toEndOf="@+id/search_back_button" android:layout_toStartOf="@+id/search_close_button" android:layout_toStartOf="@+id/search_clear_button" android:layout_centerVertical="true" android:layout_marginStart="8dp" android:minHeight="48dp" Loading
java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ <com.android.dialer.main.impl.toolbar.MainToolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/dialer_theme_color" Loading