diff options
author | Yorke Lee <yorkelee@google.com> | 2013-07-19 09:22:03 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-07-22 19:36:56 -0700 |
commit | d99993213962df64c9d76005df86c2fb83fca074 (patch) | |
tree | f8c1d5a39e4d64968e63026227e4a9a1be2a3871 | |
parent | 7025bfa554aabaf1824c208481eea4963bc4c425 (diff) |
Style and layout changes to match redlines
* Swapped out some icons with newly added assets.
* Changed search view into edit text with accompanying close button
so that it can be more easily styled.
* Changed various background colors.
* Tweaked padding values to match redlines
* Removed margins from PhoneFavoriteRegularRowView and PhoneFavoriteTileView
and instead use a standardized set of margins for all rows in
PhoneFavoritesTileAdapter
* Added bottom_border_background drawable to create a bordered background.
* Remove PhoneFavoritesTileAdapter.ViewTypes.STARRED/STARRED_PHONE since
they are no longer relevant
Change-Id: I65dfd5adf6cfbcb2c9d283aef2bd10e5d2a82dc7
38 files changed, 203 insertions, 170 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 273429ca6..e66733c62 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -175,12 +175,11 @@ <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.TAB" /> </intent-filter> - --> - + --> </activity> <activity android:name="com.android.dialer.calllog.NewCallLogActivity" - android:label="@string/recentCallsIconLabel" + android:label="@string/call_log_activity_title" android:theme="@style/NewDialtactsTheme" android:screenOrientation="portrait" android:icon="@mipmap/ic_launcher_phone"> diff --git a/res/anim/slide_in.xml b/res/anim/slide_in.xml index b7836f0c3..31502a971 100644 --- a/res/anim/slide_in.xml +++ b/res/anim/slide_in.xml @@ -15,7 +15,7 @@ --> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/linear_interpolator" + android:interpolator="@android:anim/decelerate_interpolator" android:valueFrom="0.67" android:valueTo="0" android:valueType="floatType" diff --git a/res/anim/slide_out.xml b/res/anim/slide_out.xml index 7df102dfa..e037009f7 100644 --- a/res/anim/slide_out.xml +++ b/res/anim/slide_out.xml @@ -15,7 +15,7 @@ --> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@android:anim/linear_interpolator" + android:interpolator="@android:anim/decelerate_interpolator" android:valueFrom="0" android:valueTo="0.67" android:valueType="floatType" diff --git a/res/drawable-hdpi/ic_ab_dialer_holo_light.png b/res/drawable-hdpi/ic_ab_dialer_holo_light.png Binary files differnew file mode 100644 index 000000000..7e3457661 --- /dev/null +++ b/res/drawable-hdpi/ic_ab_dialer_holo_light.png diff --git a/res/drawable-hdpi/ic_close_dk.png b/res/drawable-hdpi/ic_close_dk.png Binary files differnew file mode 100644 index 000000000..f5e378fbc --- /dev/null +++ b/res/drawable-hdpi/ic_close_dk.png diff --git a/res/drawable-hdpi/ic_contact_info.png b/res/drawable-hdpi/ic_contact_info.png Binary files differnew file mode 100644 index 000000000..9c23000d9 --- /dev/null +++ b/res/drawable-hdpi/ic_contact_info.png diff --git a/res/drawable-hdpi/ic_dialer_menu_dialpad_dk.png b/res/drawable-hdpi/ic_dialer_menu_dialpad_dk.png Binary files differnew file mode 100644 index 000000000..4da8f2855 --- /dev/null +++ b/res/drawable-hdpi/ic_dialer_menu_dialpad_dk.png diff --git a/res/drawable-hdpi/ic_dialer_menu_history_dk.png b/res/drawable-hdpi/ic_dialer_menu_history_dk.png Binary files differnew file mode 100644 index 000000000..b8d1944b2 --- /dev/null +++ b/res/drawable-hdpi/ic_dialer_menu_history_dk.png diff --git a/res/drawable-hdpi/ic_menu_overflow_dark.png b/res/drawable-hdpi/ic_menu_overflow_dark.png Binary files differnew file mode 100644 index 000000000..69741cbf0 --- /dev/null +++ b/res/drawable-hdpi/ic_menu_overflow_dark.png diff --git a/res/drawable-hdpi/ic_play_holo_light.png b/res/drawable-hdpi/ic_play_holo_light.png Binary files differnew file mode 100644 index 000000000..684df0074 --- /dev/null +++ b/res/drawable-hdpi/ic_play_holo_light.png diff --git a/res/drawable-ldrtl-mdpi/ic_ab_dialer_holo_light.png b/res/drawable-ldrtl-mdpi/ic_ab_dialer_holo_light.png Binary files differnew file mode 100644 index 000000000..1bc02cc98 --- /dev/null +++ b/res/drawable-ldrtl-mdpi/ic_ab_dialer_holo_light.png diff --git a/res/drawable-ldrtl-xhdpi/ic_ab_dialer_holo_light.png b/res/drawable-ldrtl-xhdpi/ic_ab_dialer_holo_light.png Binary files differnew file mode 100644 index 000000000..8a25e7004 --- /dev/null +++ b/res/drawable-ldrtl-xhdpi/ic_ab_dialer_holo_light.png diff --git a/res/drawable-mdpi/ic_close_dk.png b/res/drawable-mdpi/ic_close_dk.png Binary files differnew file mode 100644 index 000000000..13f68ee36 --- /dev/null +++ b/res/drawable-mdpi/ic_close_dk.png diff --git a/res/drawable-mdpi/ic_contact_info.png b/res/drawable-mdpi/ic_contact_info.png Binary files differnew file mode 100644 index 000000000..5d35ec579 --- /dev/null +++ b/res/drawable-mdpi/ic_contact_info.png diff --git a/res/drawable-mdpi/ic_dialer_menu_dialpad_dk.png b/res/drawable-mdpi/ic_dialer_menu_dialpad_dk.png Binary files differnew file mode 100644 index 000000000..5a3ac0c33 --- /dev/null +++ b/res/drawable-mdpi/ic_dialer_menu_dialpad_dk.png diff --git a/res/drawable-mdpi/ic_dialer_menu_history_dk.png b/res/drawable-mdpi/ic_dialer_menu_history_dk.png Binary files differnew file mode 100644 index 000000000..d9306baf6 --- /dev/null +++ b/res/drawable-mdpi/ic_dialer_menu_history_dk.png diff --git a/res/drawable-mdpi/ic_menu_overflow_dark.png b/res/drawable-mdpi/ic_menu_overflow_dark.png Binary files differnew file mode 100644 index 000000000..2a477c827 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_overflow_dark.png diff --git a/res/drawable-mdpi/ic_play_holo_light.png b/res/drawable-mdpi/ic_play_holo_light.png Binary files differnew file mode 100644 index 000000000..f36edf93b --- /dev/null +++ b/res/drawable-mdpi/ic_play_holo_light.png diff --git a/res/drawable-xhdpi/ic_close_dk.png b/res/drawable-xhdpi/ic_close_dk.png Binary files differnew file mode 100644 index 000000000..4f965fe6b --- /dev/null +++ b/res/drawable-xhdpi/ic_close_dk.png diff --git a/res/drawable-xhdpi/ic_contact_info.png b/res/drawable-xhdpi/ic_contact_info.png Binary files differnew file mode 100644 index 000000000..88d367b65 --- /dev/null +++ b/res/drawable-xhdpi/ic_contact_info.png diff --git a/res/drawable-xhdpi/ic_dialer_menu_dialpad_dk.png b/res/drawable-xhdpi/ic_dialer_menu_dialpad_dk.png Binary files differnew file mode 100644 index 000000000..317bf6611 --- /dev/null +++ b/res/drawable-xhdpi/ic_dialer_menu_dialpad_dk.png diff --git a/res/drawable-xhdpi/ic_dialer_menu_history_dk.png b/res/drawable-xhdpi/ic_dialer_menu_history_dk.png Binary files differnew file mode 100644 index 000000000..63ad62b39 --- /dev/null +++ b/res/drawable-xhdpi/ic_dialer_menu_history_dk.png diff --git a/res/drawable-xhdpi/ic_menu_overflow_dark.png b/res/drawable-xhdpi/ic_menu_overflow_dark.png Binary files differnew file mode 100644 index 000000000..8cbd50827 --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_overflow_dark.png diff --git a/res/drawable-xhdpi/ic_people_info.png b/res/drawable-xhdpi/ic_people_info.png Binary files differnew file mode 100644 index 000000000..b933bbc0f --- /dev/null +++ b/res/drawable-xhdpi/ic_people_info.png diff --git a/res/drawable-xhdpi/ic_play_holo_light.png b/res/drawable-xhdpi/ic_play_holo_light.png Binary files differnew file mode 100644 index 000000000..f79757664 --- /dev/null +++ b/res/drawable-xhdpi/ic_play_holo_light.png diff --git a/res/drawable/bottom_border_background.xml b/res/drawable/bottom_border_background.xml new file mode 100644 index 000000000..9a35e8a4d --- /dev/null +++ b/res/drawable/bottom_border_background.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2013 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. +--> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > + +<item> + <shape android:shape="rectangle" > + <solid android:color="@color/favorite_contacts_separator_color" /> + <padding android:bottom="1dp" /> + </shape> +</item> +<item> + <shape android:shape="rectangle" > + <solid android:color="@color/background_dial_holo_light" /> + </shape> +</item> +</layer-list>
\ No newline at end of file diff --git a/res/layout/new_dialtacts_activity.xml b/res/layout/new_dialtacts_activity.xml index a9960d8e3..7845d0fef 100644 --- a/res/layout/new_dialtacts_activity.xml +++ b/res/layout/new_dialtacts_activity.xml @@ -22,17 +22,36 @@ android:clipChildren="false" android:id="@+id/dialtacts_container" > + <!-- Overlapping dialpad fragment is inserted here --> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" android:orientation="vertical" > - <SearchView - android:id="@+id/search_view" + <LinearLayout android:layout_width="match_parent" - android:layout_height="?android:attr/actionBarSize" - android:iconifiedByDefault="false" - android:inputType="textFilter" /> + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="23dp" + android:id="@+id/search_view_container" + android:background="@color/searchbox_background_color" + android:orientation="horizontal" + android:gravity="center_vertical"> + <EditText + android:id="@+id/search_view" + android:layout_width="0dp" + android:layout_height="56dp" + android:layout_weight="1" + android:inputType="textFilter"/> + <ImageView + android:id="@+id/search_close_button" + android:layout_height="40dp" + android:layout_width="40dp" + android:padding="6dp" + android:src="@drawable/ic_close_dk" + android:background="?android:attr/selectableItemBackground" + android:visibility="gone" /> + </LinearLayout> <FrameLayout android:layout_height="0dp" android:layout_weight="1" diff --git a/res/layout/new_phone_favorites_fragment.xml b/res/layout/new_phone_favorites_fragment.xml index 33a3eb43a..90d0aacd2 100644 --- a/res/layout/new_phone_favorites_fragment.xml +++ b/res/layout/new_phone_favorites_fragment.xml @@ -46,9 +46,10 @@ android:textAppearance="?android:attr/textAppearanceLarge"/> </FrameLayout> <FrameLayout - android:layout_height="?android:attr/actionBarSize" + android:layout_height="48dp" android:layout_width="match_parent" - android:id="@+id/fake_action_bar"> + android:id="@+id/fake_action_bar" + android:background="@color/actionbar_background_color"> <ImageButton android:id="@+id/call_history_button" android:layout_width="@dimen/fake_menu_button_min_width" @@ -56,7 +57,7 @@ android:layout_gravity="bottom|start" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/description_search_button" - android:src="@drawable/ic_dial_action_search"/> + android:src="@drawable/ic_dialer_menu_history_dk"/> <ImageButton android:id="@+id/dialpad_button" android:layout_width="@dimen/fake_menu_button_min_width" @@ -64,13 +65,13 @@ android:layout_gravity="bottom|center" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/description_search_button" - android:src="@drawable/ic_dial_action_search"/> + android:src="@drawable/ic_dialer_menu_dialpad_dk"/> <ImageButton android:id="@+id/overflow_menu" android:layout_width="@dimen/fake_menu_button_min_width" android:layout_height="match_parent" android:layout_gravity="bottom|end" - android:src="@drawable/ic_menu_overflow" + android:src="@drawable/ic_menu_overflow_dark" android:contentDescription="@string/action_menu_overflow_description" android:background="?android:attr/selectableItemBackground"/> </FrameLayout> diff --git a/res/layout/phone_favorite_regular_row_view.xml b/res/layout/phone_favorite_regular_row_view.xml index 30e109f9e..eda5a02c8 100644 --- a/res/layout/phone_favorite_regular_row_view.xml +++ b/res/layout/phone_favorite_regular_row_view.xml @@ -52,55 +52,6 @@ android:fadingEdgeLength="3dip" android:ellipsize="marquee" android:textAlignment="viewStart" /> - - <LinearLayout - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/contact_tile_name" - android:layout_toRightOf="@id/contact_tile_quick" - android:layout_toEndOf="@id/contact_tile_quick" - android:gravity="center_vertical"> - - <TextView - android:id="@+id/contact_tile_phone_number" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="?attr/list_item_data_width_weight" - android:textSize="14sp" - android:ellipsize="marquee" - android:textColor="@color/dialtacts_secondary_text_color" - android:layout_marginLeft="8dip" - android:layout_marginStart="8dip" - android:singleLine="true" - android:layout_gravity="bottom" - android:textDirection="ltr" - android:textAlignment="viewStart" /> - - <TextView - android:id="@+id/contact_tile_phone_type" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="?attr/list_item_label_width_weight" - android:textSize="12sp" - android:ellipsize="marquee" - android:singleLine="true" - android:textAllCaps="true" - android:textColor="@color/dialtacts_secondary_text_color" - android:layout_marginLeft="8dip" - android:layout_marginStart="8dip" - android:gravity="end" - android:layout_gravity="bottom" /> - - </LinearLayout> - - <View - android:id="@+id/contact_tile_horizontal_divider" - android:layout_width="match_parent" - android:layout_height="1px" - android:background="?android:attr/listDivider" - android:layout_below="@id/contact_tile_quick" /> - </RelativeLayout> </view> diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml index f6e44d857..bf9020557 100644 --- a/res/layout/phone_favorite_tile_view.xml +++ b/res/layout/phone_favorite_tile_view.xml @@ -60,14 +60,16 @@ <ImageButton android:id="@id/contact_tile_secondary_button" - android:src="@drawable/ic_contacts_holo_dark" + android:src="@drawable/ic_contact_info" android:background="?android:attr/selectableItemBackground" android:layout_height="@dimen/contact_tile_shadowbox_height" android:layout_width="48dip" - android:paddingLeft="8dip" - android:paddingRight="8dip" - android:paddingStart="8dip" - android:paddingEnd="8dip" + android:paddingLeft="12dip" + android:paddingRight="12dip" + android:paddingStart="12dip" + android:paddingEnd="12dip" + android:paddingTop="12dip" + android:paddingBottom="12dip" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" diff --git a/res/values/colors.xml b/res/values/colors.xml index 672c970b3..2534cb5ac 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -44,7 +44,7 @@ <color name="item_selected">#660099cc</color> <!-- Background color of new dialer activity --> - <color name="background_dial_holo_light">#ffffff</color> + <color name="background_dial_holo_light">#f5f5f5</color> <!-- Background color of new dialpad --> <color name="background_dialpad">#ee020709</color> @@ -55,4 +55,15 @@ --> <color name="dialpad_secondary_text_color">#888888</color> + <!-- Background color of fake action bar in the favorites fragment --> + <color name="actionbar_background_color">#e6e6e6</color> + + <!-- Color of the 1dp divider that separates favorites --> + <color name="favorite_contacts_separator_color">#d0d0d0</color> + + <!-- Background color of the search box --> + <color name="searchbox_background_color">#ffffff</color> + <!-- Text color of the search box --> + <color name="searchbox_text_color">#d3d3d3</color> + </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 474f57227..0c5d22e10 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -57,4 +57,10 @@ <dimen name="smartdial_suggestions_extra_padding">2dp</dimen> <dimen name="smartdial_confidence_hint_text_size">27dp</dimen> + <!-- Favorites tile padding --> + <dimen name="phone_contact_tile_divider_padding">3dp</dimen> + <dimen name="favorites_row_top_padding">8dp</dimen> + <dimen name="favorites_row_bottom_padding">8dp</dimen> + <dimen name="favorites_row_start_padding">8dp</dimen> + <dimen name="favorites_row_end_padding">8dp</dimen> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 9be7481b9..7c1020873 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -538,4 +538,7 @@ <!-- Menu option to show favorite contacts only --> <string name="show_favorites_only">Show favorites only</string> + + <!-- Title of activity that displays a list of all calls --> + <string name="call_log_activity_title">History</string> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index cb36090cb..59322949a 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -73,6 +73,8 @@ <item name="android:actionBarStyle">@style/DialtactsActionBarStyleNew</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowBackground">@color/background_dial_holo_light</item> + <!-- Searchbox Style --> + <item name="android:editTextStyle">@style/DialtactsSearchboxStyle</item> <item name="android:listViewStyle">@style/ListViewStyle</item> <item name="activated_background">@drawable/list_item_activated_background</item> <item name="section_header_background">@drawable/list_title_holo</item> @@ -167,6 +169,9 @@ <style name="DialtactsActionBarStyleNew" parent="android:Widget.Holo.ActionBar"> <item name="android:backgroundSplit">@null</item> + <item name="android:background">@color/actionbar_background_color</item> + <!-- Empty icon --> + <item name="android:icon">@android:color/transparent</item> <item name="android:displayOptions"></item> </style> @@ -183,4 +188,9 @@ <style name="FragmentActionBarPadding"> <item name="android:paddingBottom">?android:attr/actionBarSize</item> </style> + + <style name="DialtactsSearchboxStyle" parent="@android:style/Widget.EditText"> + <item name="android:background">@null</item> + <item name="android:textColorHint">@color/searchbox_text_color</item> + </style> </resources> diff --git a/src/com/android/dialer/NewDialtactsActivity.java b/src/com/android/dialer/NewDialtactsActivity.java index 66cbe8530..54e7df258 100644 --- a/src/com/android/dialer/NewDialtactsActivity.java +++ b/src/com/android/dialer/NewDialtactsActivity.java @@ -28,6 +28,7 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Resources; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; @@ -37,7 +38,9 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents.UI; import android.provider.Settings; +import android.text.Editable; import android.text.TextUtils; +import android.text.TextWatcher; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -46,6 +49,8 @@ import android.view.View.OnFocusChangeListener; import android.view.ViewConfiguration; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView.OnScrollListener; +import android.widget.EditText; +import android.widget.ImageView; import android.widget.PopupMenu; import android.widget.SearchView; import android.widget.SearchView.OnCloseListener; @@ -145,7 +150,9 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie * {@link PhoneNumberPickerFragment}). */ private boolean mInSearchUi; - private SearchView mSearchView; + private View mSearchViewContainer; + private View mSearchViewCloseButton; + private EditText mSearchView; /** * The index of the Fragment (or, the tab) that has last been manually selected. @@ -181,61 +188,42 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie /** * Listener used to send search queries to the phone search fragment. */ - private final OnQueryTextListener mPhoneSearchQueryTextListener = - new OnQueryTextListener() { - @Override - public boolean onQueryTextSubmit(String query) { - View view = getCurrentFocus(); - if (view != null) { - hideInputMethod(view); - view.clearFocus(); - } - return true; + private final TextWatcher mPhoneSearchQueryTextListener = new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + final boolean smartDialSearch = isDialpadShowing(); + final String newText = s.toString(); + // Show search result with non-empty text. Show a bare list otherwise. + if (TextUtils.isEmpty(newText) && mInSearchUi) { + exitSearchUi(); + mSearchViewCloseButton.setVisibility(View.GONE); + return; + } else if (!TextUtils.isEmpty(newText) && !mInSearchUi) { + enterSearchUi(smartDialSearch); } - @Override - public boolean onQueryTextChange(String newText) { - final boolean smartDialSearch = isDialpadShowing(); - - // Show search result with non-empty text. Show a bare list otherwise. - if (TextUtils.isEmpty(newText) && mInSearchUi) { - exitSearchUi(); - return true; - } else if (!TextUtils.isEmpty(newText) && !mInSearchUi) { - enterSearchUi(smartDialSearch); - } - - if (isDialpadShowing()) { - mSmartDialSearchFragment.setQueryString(newText, false); - } else { - mRegularSearchFragment.setQueryString(newText, false); - } - return true; + if (isDialpadShowing()) { + mSmartDialSearchFragment.setQueryString(newText, false); + } else { + mRegularSearchFragment.setQueryString(newText, false); } + mSearchViewCloseButton.setVisibility(View.VISIBLE); + return; + } + + @Override + public void afterTextChanged(Editable s) { + } }; private boolean isDialpadShowing() { return mDialpadFragment.isVisible(); } - /** - * Listener used to handle the "close" button on the right side of {@link SearchView}. - * If some text is in the search view, this will clean it up. Otherwise this will exit - * the search UI and let users go back to usual Phone UI. - * - * This does _not_ handle back button. - */ - private final OnCloseListener mPhoneSearchCloseListener = - new OnCloseListener() { - @Override - public boolean onClose() { - if (!TextUtils.isEmpty(mSearchView.getQuery())) { - mSearchView.setQuery(null, true); - } - return true; - } - }; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -362,6 +350,12 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie final Intent intent = new Intent(this, NewCallLogActivity.class); startActivity(intent); break; + case R.id.search_close_button: + // Clear the search field + if (!TextUtils.isEmpty(mSearchView.getText())) { + mSearchView.setText(""); + } + break; default: { Log.wtf(TAG, "Unexpected onClick event from " + view); break; @@ -384,20 +378,14 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie } private void prepareSearchView() { - mSearchView = (SearchView) findViewById(R.id.search_view); - mSearchView.setOnQueryTextListener(mPhoneSearchQueryTextListener); - mSearchView.setOnCloseListener(mPhoneSearchCloseListener); - // Since we're using a custom layout for showing SearchView instead of letting the - // search menu icon do that job, we need to manually configure the View so it looks - // "shown via search menu". - // - it should be iconified by default - // - it should not be iconified at this time - // See also comments for onActionViewExpanded()/onActionViewCollapsed() - mSearchView.setIconifiedByDefault(true); - mSearchView.setQueryHint(getString(R.string.dialer_hint_find_contact)); - mSearchView.setIconified(false); - mSearchView.clearFocus(); - mSearchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() { + mSearchViewContainer = findViewById(R.id.search_view_container); + mSearchViewCloseButton = findViewById(R.id.search_close_button); + mSearchViewCloseButton.setClickable(true); + mSearchViewCloseButton.setOnClickListener(this); + mSearchView = (EditText) findViewById(R.id.search_view); + mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); + mSearchView.setHint(getString(R.string.dialer_hint_find_contact)); + mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { @@ -416,19 +404,19 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie final AnimatorListener mHideListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mSearchView.setVisibility(View.GONE); + mSearchViewContainer.setVisibility(View.GONE); } }; public void hideSearchBar() { - mSearchView.animate().cancel(); - mSearchView.setAlpha(1); - mSearchView.setTranslationY(0); - mSearchView.animate().withLayer().alpha(0).translationY(-mSearchView.getHeight()). - setDuration(200).setListener(mHideListener); + mSearchViewContainer.animate().cancel(); + mSearchViewContainer.setAlpha(1); + mSearchViewContainer.setTranslationY(0); + mSearchViewContainer.animate().withLayer().alpha(0).translationY(-mSearchView.getHeight()) + .setDuration(200).setListener(mHideListener); mPhoneFavoriteFragment.getView().animate().withLayer() - .translationY(-mSearchView.getHeight()).setDuration(200).setListener( + .translationY(-mSearchViewContainer.getHeight()).setDuration(200).setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -439,18 +427,18 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie } public void showSearchBar() { - mSearchView.animate().cancel(); - mSearchView.setAlpha(0); - mSearchView.setTranslationY(-mSearchView.getHeight()); - mSearchView.animate().withLayer().alpha(1).translationY(0).setDuration(200) + mSearchViewContainer.animate().cancel(); + mSearchViewContainer.setAlpha(0); + mSearchViewContainer.setTranslationY(-mSearchViewContainer.getHeight()); + mSearchViewContainer.animate().withLayer().alpha(1).translationY(0).setDuration(200) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { - mSearchView.setVisibility(View.VISIBLE); + mSearchViewContainer.setVisibility(View.VISIBLE); } }); - mPhoneFavoriteFragment.getView().setTranslationY(-mSearchView.getHeight()); + mPhoneFavoriteFragment.getView().setTranslationY(-mSearchViewContainer.getHeight()); mPhoneFavoriteFragment.getView().animate().withLayer().translationY(0).setDuration(200) .setListener( new AnimatorListenerAdapter() { @@ -728,7 +716,7 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie if (mDialpadFragment.isVisible()) { hideDialpadFragment(); } else if (mInSearchUi) { - mSearchView.setQuery(null, false); + mSearchView.setText(null); } else if (isTaskRoot()) { // Instead of stopping, simply push this to the back of the stack. // This is only done when running at the top of the stack; @@ -744,8 +732,8 @@ public class NewDialtactsActivity extends TransactionSafeActivity implements Vie public void onDialpadQueryChanged(String query) { final String normalizedQuery = SmartDialNameMatcher.normalizeNumber(query, SmartDialNameMatcher.LATIN_SMART_DIAL_MAP); - if (!TextUtils.equals(mSearchView.getQuery(), normalizedQuery)) { - mSearchView.setQuery(normalizedQuery, false); + if (!TextUtils.equals(mSearchView.getText(), normalizedQuery)) { + mSearchView.setText(normalizedQuery); } } diff --git a/src/com/android/dialer/calllog/NewCallLogListItemHelper.java b/src/com/android/dialer/calllog/NewCallLogListItemHelper.java index 6cb80a051..6b4f10151 100644 --- a/src/com/android/dialer/calllog/NewCallLogListItemHelper.java +++ b/src/com/android/dialer/calllog/NewCallLogListItemHelper.java @@ -84,7 +84,7 @@ import com.android.dialer.R; private void configureCallSecondaryAction(CallLogListItemViews views, PhoneCallDetails details) { views.secondaryActionView.setVisibility(View.VISIBLE); - views.secondaryActionView.setImageResource(R.drawable.ic_ab_dialer_holo_dark); + views.secondaryActionView.setImageResource(R.drawable.ic_ab_dialer_holo_light); views.secondaryActionView.setContentDescription(getCallActionDescription(details)); } @@ -104,7 +104,7 @@ import com.android.dialer.R; private void configurePlaySecondaryAction(CallLogListItemViews views, boolean isHighlighted) { views.secondaryActionView.setVisibility(View.VISIBLE); views.secondaryActionView.setImageResource( - isHighlighted ? R.drawable.ic_play_active_holo_dark : R.drawable.ic_play_holo_dark); + isHighlighted ? R.drawable.ic_play_active_holo_dark : R.drawable.ic_play_holo_light); views.secondaryActionView.setContentDescription( mResources.getString(R.string.description_call_log_play_button)); } diff --git a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java index 49d46a851..fff5c9f7c 100644 --- a/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java +++ b/src/com/android/dialer/list/NewPhoneFavoriteMergedAdapter.java @@ -250,13 +250,11 @@ public class NewPhoneFavoriteMergedAdapter extends BaseAdapter implements Sectio final int frequentHeaderPosition = mContactTileAdapter.getFrequentHeaderPosition(); // TODO krelease: Get rid of frequent header position, we don't need it anymore if (position >= frequentHeaderPosition) { - // Views for "frequent" contacts use FrameLayout's margins instead of padding. final FrameLayout frameLayout = (FrameLayout) view; final View child = frameLayout.getChildAt(0); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); - params.setMargins(mItemPaddingLeft, 0, mItemPaddingRight, 0); child.setLayoutParams(params); } return view; diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index 36fc34608..48660ff02 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -43,7 +43,6 @@ import java.util.ArrayList; * * This adapter has been rewritten to only support a maximum of one row for favorites. * - * TODO Krelease: Move to PhoneContactTileAdapter in Dialer package. */ public class PhoneFavoritesTileAdapter extends BaseAdapter { private static final String TAG = ContactTileAdapter.class.getSimpleName(); @@ -98,7 +97,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { // Converting padding in dips to padding in pixels mPaddingInPixels = mContext.getResources() - .getDimensionPixelSize(R.dimen.contact_tile_divider_padding); + .getDimensionPixelSize(R.dimen.phone_contact_tile_divider_padding); bindColumnIndices(); } @@ -322,7 +321,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { switch (viewType) { case ViewTypes.FREQUENT: return R.layout.phone_favorite_regular_row_view; - case ViewTypes.STARRED_PHONE: + case ViewTypes.TOP: return R.layout.phone_favorite_tile_view; default: throw new IllegalArgumentException("Unrecognized viewType " + viewType); @@ -336,7 +335,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { @Override public int getItemViewType(int position) { if (position < getRowCount(mDividerPosition)) { - return ViewTypes.STARRED_PHONE; + return ViewTypes.TOP; } else { return ViewTypes.FREQUENT; } @@ -358,12 +357,31 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { private class ContactTileRow extends FrameLayout { private int mItemViewType; private int mLayoutResId; + private final int mRowPaddingStart; + private final int mRowPaddingEnd; + private final int mRowPaddingTop; + private final int mRowPaddingBottom; public ContactTileRow(Context context, int itemViewType) { super(context); mItemViewType = itemViewType; mLayoutResId = getLayoutResourceId(mItemViewType); + final Resources resources = mContext.getResources(); + mRowPaddingStart = resources.getDimensionPixelSize( + R.dimen.favorites_row_start_padding); + mRowPaddingEnd = resources.getDimensionPixelSize( + R.dimen.favorites_row_end_padding); + mRowPaddingTop = resources.getDimensionPixelSize( + R.dimen.favorites_row_top_padding); + mRowPaddingBottom = resources.getDimensionPixelSize( + R.dimen.favorites_row_bottom_padding); + + setBackgroundResource(R.drawable.bottom_border_background); + + setPaddingRelative(mRowPaddingStart, mRowPaddingTop, mRowPaddingEnd, + mRowPaddingBottom); + // Remove row (but not children) from accessibility node tree. setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } @@ -390,7 +408,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { contactTile = (ContactTileView) inflate(mContext, mLayoutResId, null); // Note: the layoutparam set here is only actually used for FREQUENT. // We override onMeasure() for STARRED and we don't care the layout param there. - Resources resources = mContext.getResources(); + final Resources resources = mContext.getResources(); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); @@ -409,11 +427,10 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { } contactTile.loadFromContact(entry); switch (mItemViewType) { - case ViewTypes.STARRED_PHONE: + case ViewTypes.TOP: // Setting divider visibilities contactTile.setPaddingRelative(0, 0, - childIndex >= mColumnCount - 1 ? 0 : mPaddingInPixels, - isLastRow ? 0 : mPaddingInPixels); + childIndex >= mColumnCount - 1 ? 0 : mPaddingInPixels, 0); break; case ViewTypes.FREQUENT: contactTile.setHorizontalDividerVisibility( @@ -427,7 +444,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { switch (mItemViewType) { - case ViewTypes.STARRED_PHONE: + case ViewTypes.TOP: onLayoutForTiles(); return; default: @@ -440,7 +457,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { final int count = getChildCount(); // Just line up children horizontally. - int childLeft = 0; + int childLeft = getPaddingStart(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); @@ -454,8 +471,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { switch (mItemViewType) { - case ViewTypes.STARRED_PHONE: - case ViewTypes.STARRED: + case ViewTypes.TOP: onMeasureForTiles(widthMeasureSpec); return; default: @@ -484,7 +500,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { // Let width = given width. // Let height = image size + bottom paddding. - final int totalPaddingsInPixels = (mColumnCount - 1) * mPaddingInPixels; + final int totalPaddingsInPixels = (mColumnCount - 1) * mPaddingInPixels + + mRowPaddingStart + mRowPaddingEnd; // Preferred width / height for images (excluding the padding). // The actual width may be 1 pixel larger than this if we have a remainder. @@ -496,20 +513,19 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { final int childWidth = imageSize + child.getPaddingRight() // Compensate for the remainder + (i < remainder ? 1 : 0); - final int childHeight = imageSize + child.getPaddingBottom(); + final int childHeight = imageSize; child.measure( MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY) ); } - setMeasuredDimension(width, imageSize + getChildAt(0).getPaddingBottom()); + setMeasuredDimension(width, imageSize + getPaddingTop() + getPaddingBottom()); } } protected static class ViewTypes { - public static final int COUNT = 3; - public static final int STARRED = 0; - public static final int FREQUENT = 1; - public static final int STARRED_PHONE = 2; + public static final int COUNT = 2; + public static final int FREQUENT = 0; + public static final int TOP = 1; } } |