diff options
22 files changed, 166 insertions, 134 deletions
diff --git a/res/drawable-hdpi/ic_remove_highlight.png b/res/drawable-hdpi/ic_remove_highlight.png Binary files differdeleted file mode 100644 index 435ee36b0..000000000 --- a/res/drawable-hdpi/ic_remove_highlight.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_remove_highlight.png b/res/drawable-mdpi/ic_remove_highlight.png Binary files differdeleted file mode 100644 index 6a961cbb2..000000000 --- a/res/drawable-mdpi/ic_remove_highlight.png +++ /dev/null diff --git a/res/drawable-xhdpi/ic_remove_highlight.png b/res/drawable-xhdpi/ic_remove_highlight.png Binary files differdeleted file mode 100644 index 57949e317..000000000 --- a/res/drawable-xhdpi/ic_remove_highlight.png +++ /dev/null diff --git a/res/drawable-xxhdpi/ic_remove_highlight.png b/res/drawable-xxhdpi/ic_remove_highlight.png Binary files differdeleted file mode 100644 index 23ee8f6da..000000000 --- a/res/drawable-xxhdpi/ic_remove_highlight.png +++ /dev/null diff --git a/res/drawable/action_button_background.xml b/res/drawable/action_button_background.xml index fd5bc6123..ea7434f24 100644 --- a/res/drawable/action_button_background.xml +++ b/res/drawable/action_button_background.xml @@ -15,8 +15,7 @@ limitations under the License. --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:tint="?android:attr/colorControlHighlight" - android:pinned="true"> + android:color="?android:attr/colorControlHighlight"> <!-- Transparent background constrains the touch feedback ripple to the button, but also allows touch feedback ripples in the parent to show under the button. --> <item> diff --git a/res/drawable/call_log_background.xml b/res/drawable/call_log_background.xml index 4857fb54a..1b3dbc979 100644 --- a/res/drawable/call_log_background.xml +++ b/res/drawable/call_log_background.xml @@ -15,5 +15,4 @@ limitations under the License. --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:tint="?android:attr/colorControlHighlight" - android:pinned="false" />
\ No newline at end of file + android:color="?android:attr/colorControlHighlight" />
\ No newline at end of file diff --git a/res/drawable/floating_action_button.xml b/res/drawable/floating_action_button.xml index e4a9bb53e..d518dddd4 100644 --- a/res/drawable/floating_action_button.xml +++ b/res/drawable/floating_action_button.xml @@ -16,7 +16,6 @@ --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:tint="@color/dialer_accent_color" - android:pinned="true"> + android:color="@color/dialer_accent_color"> <item android:drawable="@drawable/fab_teal_background" /> </ripple> diff --git a/res/drawable/recent_lists_footer_background.xml b/res/drawable/recent_lists_footer_background.xml index 021174a16..b5029afcb 100644 --- a/res/drawable/recent_lists_footer_background.xml +++ b/res/drawable/recent_lists_footer_background.xml @@ -16,8 +16,7 @@ ~ limitations under the License --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:tint="?android:attr/colorControlHighlight" - android:pinned="false"> + android:color="?android:attr/colorControlHighlight"> <!-- Mask to constrain the ripple to the bounds of the view. --> <item android:id="@android:id/mask"> <color android:color="@android:color/white" /> diff --git a/res/drawable/view_pager_tab_background.xml b/res/drawable/view_pager_tab_background.xml index 53f891c76..1ba6c57e0 100644 --- a/res/drawable/view_pager_tab_background.xml +++ b/res/drawable/view_pager_tab_background.xml @@ -15,7 +15,7 @@ ~ limitations under the License --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:tint="@color/tab_ripple_color"> + android:color="@color/tab_ripple_color"> <item android:id="@android:id/mask"> <color android:color="@android:color/white" /> </item> diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml index c7a788da8..71e58cb48 100644 --- a/res/layout/dialtacts_activity.xml +++ b/res/layout/dialtacts_activity.xml @@ -35,49 +35,8 @@ android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/dialtacts_frame" - android:clipChildren="false" - > - </FrameLayout> - <!-- Search entry box and remove view --> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:id="@+id/search_and_remove_view_container" - android:visibility="gone" - > - </FrameLayout> + android:clipChildren="false" /> </RelativeLayout> - <com.android.dialer.list.RemoveView - android:layout_width="match_parent" - android:layout_height="56dp" - android:id="@+id/remove_view" - android:layout_alignParentTop="true" - > - <LinearLayout - android:id="@+id/remove_view_container" - android:layout_height="match_parent" - android:layout_width="match_parent" - android:gravity="center" - android:orientation="horizontal" - android:visibility="gone" > - <ImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/remove_view_icon" - android:src="@drawable/ic_remove" - android:contentDescription="@string/remove_contact" - /> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/remove_view_text" - android:textSize="@dimen/remove_text_size" - android:textColor="@color/remove_text_color" - android:text="@string/remove_contact" - /> - </LinearLayout> - </com.android.dialer.list.RemoveView > <FrameLayout android:id="@+id/floating_action_button_container" android:layout_width="@dimen/floating_action_button_width" diff --git a/res/layout/lists_fragment.xml b/res/layout/lists_fragment.xml index 02dcbe3a0..1de8364b7 100644 --- a/res/layout/lists_fragment.xml +++ b/res/layout/lists_fragment.xml @@ -16,10 +16,11 @@ <com.android.dialer.widget.OverlappingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/lists_frame" android:layout_width="match_parent" android:layout_height="match_parent" - android:animateLayoutChanges="true" - android:id="@+id/lists_frame"> + android:animateLayoutChanges="true" > + <ListView android:id="@+id/shortcut_card_list" android:layout_width="match_parent" @@ -29,24 +30,71 @@ android:clipToPadding="false" android:fadingEdge="none" android:divider="@null" /> - <LinearLayout + + <FrameLayout android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - <com.android.dialer.list.ViewPagerTabs - android:id="@+id/lists_pager_header" + android:layout_height="match_parent"> + + <LinearLayout android:layout_width="match_parent" - android:layout_height="@dimen/tab_height" - android:textAllCaps="true" - android:orientation="horizontal" - android:layout_gravity="top" - android:elevation="@dimen/tab_elevation" - style="@style/DialtactsActionBarTabTextStyle" /> - <android.support.v4.view.ViewPager - android:id="@+id/lists_pager" + android:layout_height="match_parent" + android:orientation="vertical"> + + <com.android.dialer.list.ViewPagerTabs + android:id="@+id/lists_pager_header" + android:layout_width="match_parent" + android:layout_height="@dimen/tab_height" + android:textAllCaps="true" + android:orientation="horizontal" + android:layout_gravity="top" + android:elevation="@dimen/tab_elevation" + style="@style/DialtactsActionBarTabTextStyle" /> + + <android.support.v4.view.ViewPager + android:id="@+id/lists_pager" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> + + </LinearLayout> + + <com.android.dialer.list.RemoveView + android:id="@+id/remove_view" android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1"> - </android.support.v4.view.ViewPager> - </LinearLayout> + android:layout_height="@dimen/tab_height" + android:layout_alignParentTop="true" > + + <LinearLayout + android:id="@+id/remove_view_content" + android:layout_height="match_parent" + android:layout_width="match_parent" + android:background="@color/actionbar_background_color" + android:gravity="center" + android:orientation="horizontal" + android:visibility="gone" > + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:id="@+id/remove_view_icon" + android:src="@drawable/ic_remove" + android:contentDescription="@string/remove_contact" + android:tint="@color/remove_text_color" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/remove_view_text" + android:textSize="@dimen/remove_text_size" + android:textColor="@color/remove_text_color" + android:text="@string/remove_contact" /> + + </LinearLayout> + + </com.android.dialer.list.RemoveView > + + </FrameLayout> + </com.android.dialer.widget.OverlappingPaneLayout> diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml index 1e6b999b1..d34dc7a73 100644 --- a/res/layout/phone_favorite_tile_view.xml +++ b/res/layout/phone_favorite_tile_view.xml @@ -17,7 +17,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/contact_tile" class="com.android.dialer.list.PhoneFavoriteSquareTileView" - android:paddingEnd="@dimen/contact_tile_divider_width"> + android:paddingEnd="@dimen/contact_tile_divider_width" + android:paddingBottom="@dimen/contact_tile_divider_width"> <RelativeLayout android:id="@+id/contact_favorite_card" @@ -50,8 +51,6 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingLeft="@dimen/contact_tile_text_side_padding" - android:paddingRight="@dimen/contact_tile_text_side_padding" android:paddingStart="@dimen/contact_tile_text_side_padding" android:paddingEnd="@dimen/contact_tile_text_side_padding" android:paddingBottom="@dimen/contact_tile_text_bottom_padding" diff --git a/res/values/colors.xml b/res/values/colors.xml index a5ad64167..9264e3093 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -40,7 +40,7 @@ <color name="item_selected">#660099cc</color> <!-- Background color of new dialer activity --> - <color name="background_dialer_light">#fbfbfb</color> + <color name="background_dialer_light">#f6f6f6</color> <!-- Background color of dialer list items (contacts, call log entries) --> <color name="background_dialer_list_items">@color/background_dialer_light</color> @@ -72,8 +72,7 @@ <!-- Text color for no favorites message --> <color name="nofavorite_text_color">#777777</color> - <!-- Text color for the "Remove" text in its regular state --> - <color name="remove_text_color">#555555</color> + <color name="remove_text_color">#ffffff</color> <!-- Text color for the "Remove" text when a contact is dragged on top of the remove view --> <color name="remove_highlighted_text_color">#FF3F3B</color> @@ -81,6 +80,7 @@ <!-- Color of the bottom border below the contacts grid on the main dialer screen. --> <color name="contacts_grid_bottom_border_color">#16000000</color> + <color name="call_log_expanded_background_color">#ffffff</color> <!-- Color of actions in expanded call log entries. This text color represents actions such as call back, play voicemail, etc. --> <color name="call_log_action_text">#1dc7db</color> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 4db5ae41b..53292e166 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -51,7 +51,7 @@ <item name="contact_tile_height_to_width_ratio" type="dimen">76%</item> <dimen name="contact_tile_text_side_padding">12dp</dimen> <dimen name="contact_tile_text_bottom_padding">9dp</dimen> - <dimen name="favorites_row_top_padding">1dp</dimen> + <dimen name="favorites_row_top_padding">2dp</dimen> <dimen name="favorites_row_bottom_padding">0dp</dimen> <dimen name="favorites_row_start_padding">1dp</dimen> @@ -111,7 +111,7 @@ <dimen name="search_box_right_padding">8dp</dimen> <!-- Padding around the icon in the search box. --> <dimen name="search_box_icon_margin">4dp</dimen> - <dimen name="search_box_search_icon_padding">4dp</dimen> + <dimen name="search_box_search_icon_padding">2dp</dimen> <dimen name="search_box_collapsed_text_margin_left">24dp</dimen> <dimen name="search_box_expanded_text_margin_left">26dp</dimen> <!-- Size of the icon (voice search, close search) in the search box. --> diff --git a/res/values/styles.xml b/res/values/styles.xml index 0c56d9898..40428947b 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -36,7 +36,7 @@ <item name="list_item_padding_top">12dp</item> <item name="list_item_padding_right">32dp</item> <item name="list_item_padding_bottom">12dp</item> - <item name="list_item_padding_left">0dip</item> + <item name="list_item_padding_left">16dp</item> <item name="list_item_gap_between_image_and_text">8dip</item> <item name="list_item_gap_between_label_and_data">5dip</item> <item name="list_item_presence_icon_margin">4dip</item> @@ -51,7 +51,7 @@ <item name="list_item_header_height">30dip</item> <item name="list_item_data_width_weight">5</item> <item name="list_item_label_width_weight">3</item> - <item name="contact_browser_list_padding_left">16dp</item> + <item name="contact_browser_list_padding_left">0dp</item> <item name="contact_browser_list_padding_right">0dp</item> <item name="contact_browser_background">@color/background_dialer_light</item> <item name="list_item_name_text_color">@color/contact_list_name_text_color</item> @@ -141,8 +141,7 @@ parent="android:style/Widget.Material.Light.ActionBar.TabText"> <item name="android:textColor">@color/tab_text_color</item> <item name="android:textSize">@dimen/tab_text_size</item> - <item name="android:fontFamily">@string/tab_font_family</item> - <item name="android:textStyle">bold</item> + <item name="android:fontFamily">"sans-serif-medium"</item> </style> <style name="ListViewStyle" parent="@android:style/Widget.Material.Light.ListView"> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index fc63690fe..d4ba6a225 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -49,17 +49,12 @@ import android.view.MotionEvent; import android.view.View; import android.view.View.OnDragListener; import android.view.View.OnTouchListener; -import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; -import android.view.animation.Animation.AnimationListener; import android.view.animation.AnimationUtils; -import android.view.animation.DecelerateInterpolator; -import android.view.animation.Interpolator; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView.OnScrollListener; import android.widget.EditText; import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.PopupMenu; import android.widget.RelativeLayout; import android.widget.Toast; @@ -84,7 +79,6 @@ import com.android.dialer.list.OnListFragmentScrolledListener; import com.android.dialer.list.SpeedDialFragment; import com.android.dialer.list.PhoneFavoriteSquareTileView; import com.android.dialer.list.RegularSearchFragment; -import com.android.dialer.list.RemoveView; import com.android.dialer.list.SearchFragment; import com.android.dialer.list.SmartDialSearchFragment; import com.android.dialer.widget.ActionBarController; @@ -197,13 +191,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private EditText mSearchView; private View mVoiceSearchButton; - /** - * View that contains the "Remove" dialog that shows up when the user long presses a contact. - * If the user releases a contact when hovering on top of this, the contact is unfavorited and - * removed from the speed dial list. - */ - private View mRemoveViewContainer; - private String mSearchQuery; private DialerDatabaseHelper mDialerDatabaseHelper; @@ -238,8 +225,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public boolean onDrag(View v, DragEvent event) { if (event.getAction() == DragEvent.ACTION_DRAG_LOCATION) { - mDragDropController.handleDragHovered(v, (int) event.getX(), - (int) event.getY()); + mDragDropController.handleDragHovered(v, (int) event.getX(), (int) event.getY()); } return true; } @@ -395,8 +381,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button); mFloatingActionButton.setOnClickListener(this); - mRemoveViewContainer = findViewById(R.id.remove_view_container); - mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this); SmartDialPrefix.initializeNanpSettings(this); } @@ -1006,9 +990,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onDragStarted(int x, int y, PhoneFavoriteSquareTileView view) { if (mListsFragment.isPaneOpen()) { - mActionBarController.slideActionBarUp(true); + mActionBarController.setAlpha(ListsFragment.REMOVE_VIEW_SHOWN_ALPHA); } - mRemoveViewContainer.setVisibility(View.VISIBLE); + mListsFragment.showRemoveView(true); } @Override @@ -1021,9 +1005,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onDragFinished(int x, int y) { if (mListsFragment.isPaneOpen()) { - mActionBarController.slideActionBarDown(true); + mActionBarController.setAlpha(ListsFragment.REMOVE_VIEW_HIDDEN_ALPHA); } - mRemoveViewContainer.setVisibility(View.GONE); + mListsFragment.showRemoveView(false); } @Override @@ -1036,8 +1020,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void setDragDropController(DragDropController dragController) { mDragDropController = dragController; - ((RemoveView) findViewById(R.id.remove_view)) - .setDragDropController(dragController); + mListsFragment.getRemoveView().setDragDropController(dragController); } @Override diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 924a17fc2..4ef197719 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -254,6 +254,10 @@ public class CallLogAdapter extends GroupingListAdapter private ImageView mBadgeImageView; private TextView mBadgeText; + private int mCallLogBackgroundColor; + private int mExpandedBackgroundColor; + private float mExpandedTranslationZ; + /** Listener for the primary or secondary actions in the list. * Primary opens the call details. * Secondary calls or plays. @@ -355,6 +359,9 @@ public class CallLogAdapter extends GroupingListAdapter Resources resources = mContext.getResources(); CallTypeHelper callTypeHelper = new CallTypeHelper(resources); + mCallLogBackgroundColor = resources.getColor(R.color.background_dialer_list_items); + mExpandedBackgroundColor = resources.getColor(R.color.call_log_expanded_background_color); + mExpandedTranslationZ = resources.getDimension(R.dimen.call_log_expanded_translation_z); mContactPhotoManager = ContactPhotoManager.getInstance(mContext); mPhoneNumberHelper = new PhoneNumberDisplayHelper(resources); @@ -862,10 +869,8 @@ public class CallLogAdapter extends GroupingListAdapter views.actionsView.setVisibility(View.VISIBLE); views.actionsView.setAlpha(1.0f); - views.callLogEntryView.setBackgroundColor( - callLogItem.getResources().getColor(R.color.background_dialer_light)); - callLogItem.setTranslationZ(callLogItem.getResources().getDimension( - R.dimen.call_log_expanded_translation_z)); + views.callLogEntryView.setBackgroundColor(mExpandedBackgroundColor); + callLogItem.setTranslationZ(mExpandedTranslationZ); // Attempt to give accessibility focus to one of the action buttons. // This ensures that a user realizes the expansion occurred. @@ -882,8 +887,7 @@ public class CallLogAdapter extends GroupingListAdapter views.actionsView.setVisibility(View.GONE); } - views.callLogEntryView.setBackgroundColor( - callLogItem.getResources().getColor(R.color.background_dialer_list_items)); + views.callLogEntryView.setBackgroundColor(mCallLogBackgroundColor); callLogItem.setTranslationZ(0); } } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 3eedcdaef..134c2a7f4 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -174,7 +174,7 @@ public class DialpadFragment extends Fragment /** Remembers if we need to clear digits field when the screen is completely gone. */ private boolean mClearDigitsOnStop; - private View mOverflowMenuButton; + private PopupMenu mOverflowPopupMenu; private View mDelete; private ToneGenerator mToneGenerator; private final Object mToneGeneratorLock = new Object(); @@ -310,10 +310,6 @@ public class DialpadFragment extends Fragment if (isDigitsEmpty()) { mDigitsFilledByIntent = false; mDigits.setCursorVisible(false); - // Set to INVISIBLE instead of GONE so that text (eg. "Type number to add") is centered. - mOverflowMenuButton.setVisibility(View.INVISIBLE); - } else if (mDialpadView.canDigitsBeEdited()){ - mOverflowMenuButton.setVisibility(View.VISIBLE); } if (mDialpadQueryListener != null) { @@ -392,9 +388,6 @@ public class DialpadFragment extends Fragment mDialpadChooser = (ListView) fragmentView.findViewById(R.id.dialpadChooser); mDialpadChooser.setOnItemClickListener(this); - mOverflowMenuButton = mDialpadView.getOverflowMenuButton(); - mOverflowMenuButton.setOnClickListener(this); - return fragmentView; } @@ -657,8 +650,10 @@ public class DialpadFragment extends Fragment mSmsPackageComponentName = DialerUtils.getSmsComponent(activity); - final PopupMenu overflowMenu = buildOptionsMenu(mOverflowMenuButton); - mOverflowMenuButton.setOnTouchListener(overflowMenu.getDragToOpenListener()); + View overflowMenuButton = mDialpadView.getOverflowMenuButton(); + mOverflowPopupMenu = buildOptionsMenu(overflowMenuButton); + overflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener()); + overflowMenuButton.setOnClickListener(this); } @Override @@ -851,11 +846,22 @@ public class DialpadFragment extends Fragment * @param invoker the View that invoked the options menu, to act as an anchor location. */ private PopupMenu buildOptionsMenu(View invoker) { - final PopupMenu popupMenu = new PopupMenu(getActivity(), invoker); + final PopupMenu popupMenu = new PopupMenu(getActivity(), invoker) { + @Override + public void show() { + final Menu menu = getMenu(); + final MenuItem sendMessage = menu.findItem(R.id.menu_send_message); + sendMessage.setVisible(mSmsPackageComponentName != null); + + boolean enable = !isDigitsEmpty(); + for (int i = 0; i < menu.size(); i++) { + menu.getItem(i).setEnabled(enable); + } + + super.show(); + } + }; popupMenu.inflate(R.menu.dialpad_options); - final Menu menu = popupMenu.getMenu(); - final MenuItem sendMessage = menu.findItem(R.id.menu_send_message); - sendMessage.setVisible(mSmsPackageComponentName != null); popupMenu.setOnMenuItemClickListener(this); return popupMenu; } @@ -883,7 +889,7 @@ public class DialpadFragment extends Fragment return; } case R.id.dialpad_overflow: { - buildOptionsMenu(view).show(); + mOverflowPopupMenu.show(); break; } default: { diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index ab790ed25..bdd2d6c44 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -68,6 +68,9 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste private static final String KEY_LAST_DISMISSED_CALL_SHORTCUT_DATE = "key_last_dismissed_call_shortcut_date"; + public static final float REMOVE_VIEW_SHOWN_ALPHA = 0.5f; + public static final float REMOVE_VIEW_HIDDEN_ALPHA = 1; + // Used with LoaderManager private static int MISSED_CALL_LOADER = 1; @@ -81,6 +84,8 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste private ViewPagerTabs mViewPagerTabs; private ViewPagerAdapter mViewPagerAdapter; private ListView mShortcutCardsListView; + private RemoveView mRemoveView; + private View mRemoveViewContent; private SpeedDialFragment mSpeedDialFragment; private CallLogFragment mRecentsFragment; private AllContactsFragment mAllContactsFragment; @@ -267,6 +272,9 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste mShortcutCardsListView = (ListView) parentView.findViewById(R.id.shortcut_card_list); mShortcutCardsListView.setAdapter(mMergedAdapter); + mRemoveView = (RemoveView) parentView.findViewById(R.id.remove_view); + mRemoveViewContent = parentView.findViewById(R.id.remove_view_content); + setupPaneLayout((OverlappingPaneLayout) parentView); return parentView; @@ -335,6 +343,19 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste } } + public void showRemoveView(boolean show) { + mRemoveViewContent.setVisibility(show ? View.VISIBLE : View.GONE); + mRemoveView.setAlpha(show ? 0 : 1); + mRemoveView.animate().alpha(show ? 1 : 0).start(); + + if (mShortcutCardsListView.getCount() > 0) { + View v = mShortcutCardsListView.getChildAt(0); + v.animate().withLayer() + .alpha(show ? REMOVE_VIEW_SHOWN_ALPHA : REMOVE_VIEW_HIDDEN_ALPHA) + .start(); + } + } + public boolean shouldShowActionBar() { return mIsPanelOpen && mActionBar != null; } @@ -361,4 +382,8 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste public SpeedDialFragment getSpeedDialFragment() { return mSpeedDialFragment; } + + public RemoveView getRemoveView() { + return mRemoveView; + } } diff --git a/src/com/android/dialer/list/RemoveView.java b/src/com/android/dialer/list/RemoveView.java index ae358fc9f..fdb08f6f5 100644 --- a/src/com/android/dialer/list/RemoveView.java +++ b/src/com/android/dialer/list/RemoveView.java @@ -21,7 +21,6 @@ public class RemoveView extends FrameLayout { int mUnhighlightedColor; int mHighlightedColor; Drawable mRemoveDrawable; - Drawable mRemoveHighlightedDrawable; public RemoveView(Context context) { super(context); @@ -43,7 +42,6 @@ public class RemoveView extends FrameLayout { mUnhighlightedColor = r.getColor(R.color.remove_text_color); mHighlightedColor = r.getColor(R.color.remove_highlighted_text_color); mRemoveDrawable = r.getDrawable(R.drawable.ic_remove); - mRemoveHighlightedDrawable = r.getDrawable(R.drawable.ic_remove_highlight); } public void setDragDropController(DragDropController controller) { @@ -79,13 +77,13 @@ public class RemoveView extends FrameLayout { private void setAppearanceNormal() { mRemoveText.setTextColor(mUnhighlightedColor); - mRemoveIcon.setImageDrawable(mRemoveDrawable); + mRemoveIcon.setColorFilter(mUnhighlightedColor); invalidate(); } private void setAppearanceHighlighted() { mRemoveText.setTextColor(mHighlightedColor); - mRemoveIcon.setImageDrawable(mRemoveHighlightedDrawable); + mRemoveIcon.setColorFilter(mHighlightedColor); invalidate(); } } diff --git a/src/com/android/dialer/widget/ActionBarController.java b/src/com/android/dialer/widget/ActionBarController.java index 67037a28b..0e94df498 100644 --- a/src/com/android/dialer/widget/ActionBarController.java +++ b/src/com/android/dialer/widget/ActionBarController.java @@ -187,6 +187,10 @@ public class ActionBarController { mIsActionBarSlidUp = false; } + public void setAlpha(float alphaValue) { + mSearchBox.animate().alpha(alphaValue).start(); + } + /** * Saves the current state of the action bar into a provided {@link Bundle} */ diff --git a/src/com/android/dialer/widget/OverlappingPaneLayout.java b/src/com/android/dialer/widget/OverlappingPaneLayout.java index e28bcc578..b513cd207 100644 --- a/src/com/android/dialer/widget/OverlappingPaneLayout.java +++ b/src/com/android/dialer/widget/OverlappingPaneLayout.java @@ -116,10 +116,18 @@ public class OverlappingPaneLayout extends ViewGroup { /** * Indicates that the layout is currently in the process of a nested pre-scroll operation where - * the child is being dragged downwards. If so, we should open the pane up to the maximum - * offset defined in {@link #mIntermediateOffset}, and no further. + * the child scrolling view is being dragged downwards, and still has the ability to consume + * scroll events itself. If so, we should open the pane up to the maximum offset defined in + * {@link #mIntermediateOffset}, and no further, so that the child view can continue performing + * its own scroll. */ - boolean mInNestedPreScrollDownwards = false; + private boolean mInNestedPreScrollDownwards = false; + + /** + * Indicates whether or not a nested scrolling child is able to scroll internally at this point + * in time. + */ + private boolean mChildCannotConsumeScroll; /** * Stores an offset used to represent a point somewhere in between the panel's fully closed @@ -889,6 +897,7 @@ public class OverlappingPaneLayout extends ViewGroup { final boolean startNestedScroll = (nestedScrollAxes & SCROLL_AXIS_VERTICAL) != 0; if (startNestedScroll) { mIsInNestedScroll = true; + mChildCannotConsumeScroll = true; mDragHelper.startNestedScroll(mSlideableView); } if (DEBUG) { @@ -906,7 +915,8 @@ public class OverlappingPaneLayout extends ViewGroup { if (DEBUG) { Log.d(TAG, "onNestedPreScroll: " + dy); } - mInNestedPreScrollDownwards = (dy > 0 && mSlideOffsetPx <= mIntermediateOffset); + mInNestedPreScrollDownwards = + mChildCannotConsumeScroll && dy > 0 && mSlideOffsetPx <= mIntermediateOffset; mDragHelper.processNestedScroll(mSlideableView, 0, dy, consumed); } @@ -916,6 +926,7 @@ public class OverlappingPaneLayout extends ViewGroup { if (DEBUG) { Log.d(TAG, "onNestedScroll: " + dyUnconsumed); } + mChildCannotConsumeScroll = false; mInNestedPreScrollDownwards = false; // We need to flip dyUnconsumed here, because its magnitude is reversed. b/14585990 mDragHelper.processNestedScroll(mSlideableView, 0, -dyUnconsumed, null); |