am c1048880: (-s ours) am ffb07daa: am 0b218533: Merge "Fix for letter tile avatars not displaying properly in calllog DO NOT MERGE" into klp-dev
* commit 'c1048880eb52edd6533f160b0528228a1dc244f5':
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0f3285e..509960c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -15,7 +15,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.dialer">
+ package="com.android.dialer"
+ coreApp="true">
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
@@ -67,7 +68,7 @@
dialpad screen. -->
<activity android:name=".DialtactsActivity"
android:label="@string/launcherDialer"
- android:theme="@style/DialtactsTheme"
+ android:theme="@style/DialtactsThemeHiddenActionBar"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:icon="@mipmap/ic_launcher_phone"
diff --git a/res/drawable-hdpi/dialer_recent_card_bg.9.png b/res/drawable-hdpi/dialer_recent_card_bg.9.png
deleted file mode 100644
index 2bfdbcb..0000000
--- a/res/drawable-hdpi/dialer_recent_card_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_contacts_tiles.9.png b/res/drawable-hdpi/ic_contacts_tiles.9.png
new file mode 100644
index 0000000..572fdb8
--- /dev/null
+++ b/res/drawable-hdpi/ic_contacts_tiles.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_tile_for_recents_and_contact_tile.9.png b/res/drawable-hdpi/ic_tile_for_recents_and_contact_tile.9.png
new file mode 100644
index 0000000..b5f50de
--- /dev/null
+++ b/res/drawable-hdpi/ic_tile_for_recents_and_contact_tile.9.png
Binary files differ
diff --git a/res/drawable-mdpi/dialer_recent_card_bg.9.png b/res/drawable-mdpi/dialer_recent_card_bg.9.png
deleted file mode 100644
index dff6a0b..0000000
--- a/res/drawable-mdpi/dialer_recent_card_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_contacts_tiles.9.png b/res/drawable-mdpi/ic_contacts_tiles.9.png
new file mode 100644
index 0000000..343053a
--- /dev/null
+++ b/res/drawable-mdpi/ic_contacts_tiles.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_tile_for_recents_and_contact_tile.9.png b/res/drawable-mdpi/ic_tile_for_recents_and_contact_tile.9.png
new file mode 100644
index 0000000..e43b3ef
--- /dev/null
+++ b/res/drawable-mdpi/ic_tile_for_recents_and_contact_tile.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/dialer_recent_card_bg.9.png b/res/drawable-xhdpi/dialer_recent_card_bg.9.png
deleted file mode 100644
index 05d254d..0000000
--- a/res/drawable-xhdpi/dialer_recent_card_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_contacts_tiles.9.png b/res/drawable-xhdpi/ic_contacts_tiles.9.png
new file mode 100644
index 0000000..5a56587
--- /dev/null
+++ b/res/drawable-xhdpi/ic_contacts_tiles.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_tile_for_recents_and_contact_tile.9.png b/res/drawable-xhdpi/ic_tile_for_recents_and_contact_tile.9.png
new file mode 100644
index 0000000..ebfe897
--- /dev/null
+++ b/res/drawable-xhdpi/ic_tile_for_recents_and_contact_tile.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/dialer_recent_card_bg.9.png b/res/drawable-xxhdpi/dialer_recent_card_bg.9.png
deleted file mode 100644
index 87d95f0..0000000
--- a/res/drawable-xxhdpi/dialer_recent_card_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_contacts_tiles.9.png b/res/drawable-xxhdpi/ic_contacts_tiles.9.png
new file mode 100644
index 0000000..4e6872d
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_contacts_tiles.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_tile_for_recents_and_contact_tile.9.png b/res/drawable-xxhdpi/ic_tile_for_recents_and_contact_tile.9.png
new file mode 100644
index 0000000..0a99cdb
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_tile_for_recents_and_contact_tile.9.png
Binary files differ
diff --git a/res/drawable/background_all_contacts.xml b/res/drawable/background_favorites_menu.xml
similarity index 86%
rename from res/drawable/background_all_contacts.xml
rename to res/drawable/background_favorites_menu.xml
index 0d3703f..60933fd 100644
--- a/res/drawable/background_all_contacts.xml
+++ b/res/drawable/background_favorites_menu.xml
@@ -18,12 +18,12 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape android:shape="rectangle" >
- <solid android:color="@color/all_contacts_button_color" />
+ <solid android:color="@color/favorites_menu_background_color" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle" >
- <solid android:color="@color/all_contacts_button_pressed_color" />
+ <solid android:color="@color/favorites_menu_pressed_color" />
</shape>
</item>
</selector>
\ No newline at end of file
diff --git a/res/drawable/shadow_fade_up.xml b/res/drawable/shadow_fade_up.xml
new file mode 100644
index 0000000..e2d9934
--- /dev/null
+++ b/res/drawable/shadow_fade_up.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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:type="linear"
+ android:startColor="#66999999"
+ android:endColor="#00ffffff"
+ android:angle="90"/>
+</shape>
\ No newline at end of file
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index e39b413..e17dc27 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -147,12 +147,8 @@
<!-- The secondary action button; either play voicemail or call details. -->
<ImageButton
android:id="@+id/secondary_action_icon"
- android:layout_width="match_parent"
+ android:layout_width="fill_parent"
android:layout_height="match_parent"
- android:paddingStart="@dimen/call_log_inner_margin"
- android:paddingTop="@dimen/call_log_inner_margin"
- android:paddingBottom="@dimen/call_log_inner_margin"
- android:paddingEnd="@dimen/call_log_inner_margin"
android:scaleType="center"
android:background="?android:attr/selectableItemBackground"
android:nextFocusLeft="@id/primary_action_view"
diff --git a/res/layout/dialpad.xml b/res/layout/dialpad.xml
index c3db420..c13f525 100644
--- a/res/layout/dialpad.xml
+++ b/res/layout/dialpad.xml
@@ -22,7 +22,6 @@
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
- android:background="@android:color/transparent"
android:stretchColumns="*"
android:layoutDirection="ltr" >
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml
index 239f727..dfe5c7c 100644
--- a/res/layout/dialpad_fragment.xml
+++ b/res/layout/dialpad_fragment.xml
@@ -25,7 +25,11 @@
android:layout_height="0dp"
android:layout_weight="1"
android:background="#00000000" />
-
+ <!-- Dialpad shadow -->
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="3dp"
+ android:background="@drawable/shadow_fade_up" />
<view class="com.android.dialer.dialpad.DialpadFragment$HoverIgnoringLinearLayout"
android:id="@+id/top"
android:animateLayoutChanges="true"
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index 8f9f39c..f708919 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -64,6 +64,7 @@
android:textSize="@dimen/search_text_size"
android:fontFamily="@string/search_font_family"
android:textColor="@color/searchbox_text_color"
+ android:textColorHint="@color/searchbox_hint_text_color"
android:inputType="textFilter"/>
<ImageView
android:id="@+id/search_close_button"
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml
index 8562b36..952bb2a 100644
--- a/res/layout/phone_favorite_tile_view.xml
+++ b/res/layout/phone_favorite_tile_view.xml
@@ -25,7 +25,8 @@
android:id="@+id/contact_favorite_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:focusable="true">
+ android:focusable="true"
+ android:background="@drawable/ic_contacts_tiles">
<com.android.contacts.common.widget.LayoutSuppressingImageView
android:id="@+id/contact_tile_image"
@@ -42,11 +43,11 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingLeft="8dp"
- android:paddingRight="@dimen/contact_tile_info_button_height_and_width"
- android:paddingStart="8dp"
- android:paddingEnd="@dimen/contact_tile_info_button_height_and_width"
- android:paddingBottom="12dp"
+ 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"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<TextView
@@ -71,7 +72,6 @@
android:fontFamily="sans-serif"
android:singleLine="true"
android:textSize="11sp"
- android:paddingBottom="2dp"
android:fadingEdge="horizontal"
android:fadingEdgeLength="3dip"
android:ellipsize="marquee"
diff --git a/res/layout/phone_favorites_menu.xml b/res/layout/phone_favorites_menu.xml
index 387ea5b..5f7a5a6 100644
--- a/res/layout/phone_favorites_menu.xml
+++ b/res/layout/phone_favorites_menu.xml
@@ -25,7 +25,8 @@
android:paddingRight="@dimen/favorites_menu_padding_horizontal"
android:paddingTop="@dimen/favorites_menu_padding_top"
android:paddingBottom="@dimen/favorites_menu_padding_bottom"
- android:background="@color/favorites_menu_background_color"
+ android:background="@drawable/background_favorites_menu"
+ android:addStatesFromChildren="true"
>
<TextView
android:layout_width="wrap_content"
@@ -38,7 +39,7 @@
android:layout_centerVertical="true"
android:gravity="center"
/>
- <Button
+ <TextView
android:id="@+id/all_contacts_button"
android:fontFamily="@string/favorites_menu_all_contacts_font_family"
android:layout_width="wrap_content"
@@ -47,10 +48,11 @@
android:paddingRight="@dimen/favorites_menu_padding_horizontal"
android:text="@string/favorites_menu_all_contacts"
android:textSize="@dimen/favorites_menu_all_contacts_text_size"
- android:background="@drawable/background_all_contacts"
+ android:background="@color/all_contacts_button_color"
android:textColor="@color/all_contacts_button_text_color"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center"
+ android:focusable="true"
/>
</RelativeLayout>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index e6fef3f..8712b25 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -68,8 +68,10 @@
<!-- 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>
+ <!-- Text color of the search box text as entered by user -->
+ <color name="searchbox_text_color">#000000</color>
+ <!-- Text color of the search box hint text -->
+ <color name="searchbox_hint_text_color">#d3d3d3</color>
<!-- Color of the contact name in favorite tiles -->
<color name="contact_tile_name_color">#ffffff</color>
@@ -92,11 +94,11 @@
<!-- Background color for the "All Contacts" button in the favorites menu. -->
<color name="all_contacts_button_color">#999999</color>
- <!-- Background color for the "All Contacts" button in the favorites menu when pressed. -->
- <color name="all_contacts_button_pressed_color">#808080</color>
+ <!-- Background color for the favorites menu when pressed. -->
+ <color name="favorites_menu_pressed_color">#d6d6d6</color>
<!-- Background color for the favorites menu. -->
- <color name="favorites_menu_background_color">#eeeeee</color>
+ <color name="favorites_menu_background_color">#ebebeb</color>
<!-- Text color for the "All Contacts" button above the favorite callers -->
<color name="all_contacts_button_text_color">#ffffff</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 6e563c1..9490d8d 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -27,7 +27,7 @@
<!-- Call Log -->
<dimen name="call_log_call_action_size">32dip</dimen>
- <dimen name="call_log_call_action_width">48dip</dimen>
+ <dimen name="call_log_call_action_width">54dp</dimen>
<dimen name="call_log_icon_margin">4dip</dimen>
<dimen name="call_log_inner_margin">8dip</dimen>
<dimen name="call_log_outer_margin">8dip</dimen>
@@ -38,7 +38,7 @@
<dimen name="call_detail_button_spacing">2dip</dimen>
<!-- Defines the vertical margin for the vertical separator between
the main area of a call log entry and the secondary action button. -->
- <dimen name="call_log_list_item_vertical_divider_margin">8dp</dimen>
+ <dimen name="call_log_list_item_vertical_divider_margin">17dp</dimen>
<!-- Defines the width of the vertical separator between
the main area of a call log entry and the secondary action button. -->
@@ -73,6 +73,8 @@
<dimen name="contact_tile_divider_padding">3dp</dimen>
<dimen name="contact_tile_info_button_height_and_width">36dp</dimen>
<item name="contact_tile_height_to_width_ratio" type="dimen">67%</item>
+ <dimen name="contact_tile_text_side_padding">10dp</dimen>
+ <dimen name="contact_tile_text_bottom_padding">8dp</dimen>
<dimen name="favorites_row_top_padding">6dp</dimen>
<dimen name="favorites_row_bottom_padding">6dp</dimen>
<dimen name="favorites_row_start_padding">8dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e0fc1db..3921a5d 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -77,6 +77,23 @@
<item name="favorites_padding_bottom">?android:attr/actionBarSize</item>
</style>
+ <!-- An extension of the main DialtactsTheme used when the the launcher activity is shown.
+ Ensures that there is no actionbar showing during the load of the dialer app. -->
+ <style name="DialtactsThemeHiddenActionBar" parent="DialtactsTheme">
+ <item name="android:actionBarStyle">@style/DialtactsHiddenActionBarStyle</item>
+ </style>
+
+ <!-- A "hidden" action bar style. Used when loading the launcher activity so that the
+ default actionbar is effectively hidden. -->
+ <style name="DialtactsHiddenActionBarStyle" parent="DialtactsActionBarStyle">
+ <item name="android:background">@color/background_dialer_light</item>
+ <item name="android:titleTextStyle">@style/DialtactsHiddenActionBarTextStyle</item>
+ </style>
+
+ <style name="DialtactsHiddenActionBarTextStyle" parent="@android:style/TextAppearance">
+ <item name="android:textColor">@color/background_dialer_light</item>
+ </style>
+
<!-- Action bar overflow menu icon. -->
<style name="DialtactsActionBarOverflow"
parent="@android:style/Widget.Holo.ActionButton.Overflow">
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index c510355..1e99b23 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -45,9 +45,12 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView.OnScrollListener;
import android.widget.EditText;
+import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.Toast;
@@ -119,7 +122,7 @@
private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1;
- private static final int FADE_ANIMATION_DURATION = 200;
+ private static final int ANIMATION_DURATION = 200;
private String mFilterText;
@@ -149,6 +152,7 @@
private View mDialpadButton;
private View mDialButton;
private PopupMenu mOverflowMenu;
+ private PopupMenu mDialpadOverflowMenu;
// Padding view used to shift the fragments up when the dialpad is shown.
private View mFragmentsFrame;
@@ -313,7 +317,10 @@
mFragmentsFrame = findViewById(R.id.dialtacts_frame);
mRemoveViewContainer = (RemoveView) findViewById(R.id.remove_view_container);
- mSearchAndRemoveViewContainer = (View) findViewById(R.id.search_and_remove_view_container);
+
+ mSearchAndRemoveViewContainer = findViewById(R.id.search_and_remove_view_container);
+
+ setupFakeActionBarItems();
prepareSearchView();
if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())
@@ -322,7 +329,6 @@
}
hideDialpadFragment(false, false);
- setupFakeActionBarItems();
mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this);
SmartDialPrefix.initializeNanpSettings(this);
@@ -371,10 +377,16 @@
mSmartDialSearchFragment = (SmartDialSearchFragment) fragment;
mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(
mPhoneNumberPickerActionListener);
+ if (mFragmentsFrame != null) {
+ mFragmentsFrame.setAlpha(1.0f);
+ }
} else if (fragment instanceof SearchFragment) {
mRegularSearchFragment = (RegularSearchFragment) fragment;
mRegularSearchFragment.setOnPhoneNumberPickerActionListener(
mPhoneNumberPickerActionListener);
+ if (mFragmentsFrame != null) {
+ mFragmentsFrame.setAlpha(1.0f);
+ }
} else if (fragment instanceof PhoneFavoriteFragment) {
mPhoneFavoriteFragment = (PhoneFavoriteFragment) fragment;
mPhoneFavoriteFragment.setListener(mPhoneFavoriteListener);
@@ -429,7 +441,7 @@
switch (view.getId()) {
case R.id.overflow_menu: {
if (isDialpadShowing()) {
- mDialpadFragment.optionsMenuInvoked(view);
+ mDialpadOverflowMenu.show();
} else {
mOverflowMenu.show();
}
@@ -523,6 +535,12 @@
ft.commit();
mDialButton.setVisibility(shouldShowOnscreenDialButton() ? View.VISIBLE : View.GONE);
mDialpadButton.setVisibility(View.GONE);
+
+ if (mDialpadOverflowMenu == null) {
+ mDialpadOverflowMenu = mDialpadFragment.buildOptionsMenu(mMenuButton);
+ }
+
+ mMenuButton.setOnTouchListener(mDialpadOverflowMenu.getDragToOpenListener());
}
public void hideDialpadFragment(boolean animate, boolean clearDialpad) {
@@ -540,6 +558,7 @@
ft.commit();
mDialButton.setVisibility(View.GONE);
mDialpadButton.setVisibility(View.VISIBLE);
+ mMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
}
private void prepareSearchView() {
@@ -592,17 +611,22 @@
mSearchAndRemoveViewContainer.setAlpha(1);
mSearchAndRemoveViewContainer.setTranslationY(0);
mSearchAndRemoveViewContainer.animate().withLayer().alpha(0)
- .translationY(-height).setDuration(200)
+ .translationY(-height).setDuration(ANIMATION_DURATION)
.setListener(mHideListener);
mFragmentsFrame.animate().withLayer()
- .translationY(-height).setDuration(200).setListener(
+ .translationY(-height).setDuration(ANIMATION_DURATION).setListener(
new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mFragmentsFrame.setTranslationY(0);
}
});
+
+ if (!mInDialpadSearch && !mInRegularSearch) {
+ // If the favorites fragment is showing, fade to blank.
+ mFragmentsFrame.animate().alpha(0.0f);
+ }
}
public void showSearchBar() {
@@ -611,7 +635,7 @@
mSearchAndRemoveViewContainer.setAlpha(0);
mSearchAndRemoveViewContainer.setTranslationY(-height);
mSearchAndRemoveViewContainer.animate().withLayer().alpha(1).translationY(0)
- .setDuration(200).setListener(new AnimatorListenerAdapter() {
+ .setDuration(ANIMATION_DURATION).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mSearchAndRemoveViewContainer.setVisibility(View.VISIBLE);
@@ -619,7 +643,8 @@
});
mFragmentsFrame.setTranslationY(-height);
- mFragmentsFrame.animate().withLayer().translationY(0).setDuration(200)
+ mFragmentsFrame.animate().withLayer().translationY(0).setDuration(ANIMATION_DURATION)
+ .alpha(1.0f)
.setListener(
new AnimatorListenerAdapter() {
@Override
@@ -628,23 +653,19 @@
});
}
-
- public void setupFakeActionBarItems() {
+ private void setupFakeActionBarItems() {
mMenuButton = findViewById(R.id.overflow_menu);
if (mMenuButton != null) {
mMenuButton.setOnClickListener(this);
-
- mOverflowMenu = new OverflowPopupMenu(DialtactsActivity.this, mMenuButton);
- final Menu menu = mOverflowMenu.getMenu();
- mOverflowMenu.inflate(R.menu.dialtacts_options);
- mOverflowMenu.setOnMenuItemClickListener(this);
+ if (mOverflowMenu == null) {
+ mOverflowMenu = buildOptionsMenu(mMenuButton);
+ }
mMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
}
mFakeActionBar = findViewById(R.id.fake_action_bar);
mCallHistoryButton = findViewById(R.id.call_history_button);
- // mCallHistoryButton.setMinimumWidth(fakeMenuItemWidth);
mCallHistoryButton.setOnClickListener(this);
mDialButton = findViewById(R.id.dial_button);
@@ -652,10 +673,16 @@
mDialButton.setOnLongClickListener(this);
mDialpadButton = findViewById(R.id.dialpad_button);
- // DialpadButton.setMinimumWidth(fakeMenuItemWidth);
mDialpadButton.setOnClickListener(this);
}
+ private PopupMenu buildOptionsMenu(View invoker) {
+ PopupMenu menu = new OverflowPopupMenu(this, invoker);
+ menu.inflate(R.menu.dialtacts_options);
+ menu.setOnMenuItemClickListener(this);
+ return menu;
+ }
+
private void fixIntent(Intent intent) {
// This should be cleaned up: the call key used to send an Intent
// that just said to go to the recent calls list. It now sends this
@@ -854,7 +881,6 @@
}
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
- transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
SearchFragment fragment;
if (mInDialpadSearch) {
@@ -900,6 +926,10 @@
// transitioned between search fragments
getFragmentManager().popBackStack(0, FragmentManager.POP_BACK_STACK_INCLUSIVE);
setNotInSearchUi();
+
+ if (isDialpadShowing()) {
+ mFragmentsFrame.setAlpha(0);
+ }
}
/** Returns an Intent to launch Call Settings screen */
@@ -952,7 +982,9 @@
@Override
public void setDialButtonEnabled(boolean enabled) {
- mDialButton.setEnabled(enabled);
+ if (mDialButton != null) {
+ mDialButton.setEnabled(enabled);
+ }
}
@Override
@@ -988,7 +1020,7 @@
@Override
public void onDragStarted(int itemIndex, int x, int y, PhoneFavoriteTileView view) {
- crossfadeViews(mRemoveViewContainer, mSearchViewContainer, FADE_ANIMATION_DURATION);
+ crossfadeViews(mRemoveViewContainer, mSearchViewContainer, ANIMATION_DURATION);
}
@Override
@@ -996,7 +1028,7 @@
@Override
public void onDragFinished(int x, int y) {
- crossfadeViews(mSearchViewContainer, mRemoveViewContainer, FADE_ANIMATION_DURATION);
+ crossfadeViews(mSearchViewContainer, mRemoveViewContainer, ANIMATION_DURATION);
}
@Override
@@ -1026,7 +1058,7 @@
fadeIn.setVisibility(View.VISIBLE);
fadeIn.setAlpha(0);
- fadeIn.animate().alpha(1).setDuration(FADE_ANIMATION_DURATION)
+ fadeIn.animate().alpha(1).setDuration(ANIMATION_DURATION)
.setListener(null);
}
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index aee24ba..175a733 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -642,8 +642,11 @@
contactType = ContactPhotoManager.TYPE_BUSINESS;
}
- String lookupKey = lookupUri == null ? null
- : ContactInfoHelper.getLookupKeyFromUri(lookupUri);
+ String lookupKey = info.lookupKey;
+ if (lookupUri != null) {
+ //lookupKey = ContactInfoHelper.getLookupKeyFromUri(lookupUri);
+
+ }
String nameForDefaultImage = null;
if (TextUtils.isEmpty(name)) {
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 28edcf3..e1a01b4 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -282,6 +282,7 @@
* {@link #mCachedNumberLookupService}.
*/
public boolean isBusiness(int sourceType) {
- return mCachedNumberLookupService.isBusiness(sourceType);
+ return mCachedNumberLookupService != null
+ && mCachedNumberLookupService.isBusiness(sourceType);
}
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 599604b..83cfbd8 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -420,7 +420,7 @@
@Override
public boolean onTouch(View v, MotionEvent event) {
if (isDigitsEmpty()) {
- hideAndClearDialpad();
+ hideAndClearDialpad(true);
return true;
}
return false;
@@ -931,18 +931,17 @@
}
/**
- * Called by the containing Activity to tell this Fragment that the gesture to display the
- * "options" menu has been invoked.
+ * Called by the containing Activity to tell this Fragment to build an overflow options
+ * menu for display by the container when appropriate.
*
* @param invoker the View that invoked the options menu, to act as an anchor location.
*/
- public void optionsMenuInvoked(View invoker) {
+ public PopupMenu buildOptionsMenu(View invoker) {
final PopupMenu popupMenu = new PopupMenu(getActivity(), invoker);
- final Menu menu = popupMenu.getMenu();
popupMenu.inflate(R.menu.dialpad_options);
popupMenu.setOnMenuItemClickListener(this);
- setupMenuItems(menu);
- popupMenu.show();
+ setupMenuItems(popupMenu.getMenu());
+ return popupMenu;
}
/**
@@ -1054,11 +1053,11 @@
public void callVoicemail() {
startActivity(getVoicemailIntent());
- hideAndClearDialpad();
+ hideAndClearDialpad(false);
}
- private void hideAndClearDialpad() {
- ((DialtactsActivity) getActivity()).hideDialpadFragment(false, true);
+ private void hideAndClearDialpad(boolean animate) {
+ ((DialtactsActivity) getActivity()).hideDialpadFragment(animate, true);
}
public static class ErrorDialogFragment extends DialogFragment {
@@ -1154,7 +1153,7 @@
(getActivity() instanceof DialtactsActivity ?
((DialtactsActivity) getActivity()).getCallOrigin() : null));
startActivity(intent);
- hideAndClearDialpad();
+ hideAndClearDialpad(false);
}
}
}
@@ -1564,6 +1563,9 @@
* Update the enabledness of the "Dial" and "Backspace" buttons if applicable.
*/
private void updateDialAndDeleteButtonEnabledState() {
+ if (getActivity() == null) {
+ return;
+ }
final boolean digitsNotEmpty = !isDigitsEmpty();
mDelete.setEnabled(digitsNotEmpty);
// On CDMA phones, if we're already on a call, we *always* enable the Dial button (since
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 675a40f..484a3d9 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -444,7 +444,8 @@
final int position = firstVisiblePosition + i;
final long itemId = mAdapter.getItemId(position);
final int itemViewType = mAdapter.getItemViewType(position);
- if (itemViewType == PhoneFavoritesTileAdapter.ViewTypes.TOP) {
+ if (itemViewType == PhoneFavoritesTileAdapter.ViewTypes.TOP &&
+ child instanceof ContactTileRow) {
// This is a tiled row, so save horizontal offsets instead
saveHorizontalOffsets((ContactTileRow) child, (ArrayList<ContactEntry>)
mAdapter.getItem(position), position);
@@ -673,12 +674,12 @@
/**
* Prepares the favorites menu which contains the static label "Speed Dial" and the
- * "All Contacts" button. Sets the onClickListener for the "All Contacts" button.
+ * "All Contacts" button. Taps anywhere in the view take the user to "All Contacts".
+ * This emulates how the headers in Play Store work.
*/
private void prepareFavoritesMenu(View favoritesMenu) {
- Button allContactsButton = (Button) favoritesMenu.findViewById(R.id.all_contacts_button);
- // Set the onClick listener for the button to bring up the all contacts view.
- allContactsButton.setOnClickListener(new OnClickListener() {
+ // Set the onClick listener for the view to bring up the all contacts view.
+ favoritesMenu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
showAllContacts();
diff --git a/src/com/android/dialer/list/PhoneFavoriteListView.java b/src/com/android/dialer/list/PhoneFavoriteListView.java
index adda3cf..078cf3e 100644
--- a/src/com/android/dialer/list/PhoneFavoriteListView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteListView.java
@@ -62,7 +62,7 @@
private Handler mScrollHandler;
private final long SCROLL_HANDLER_DELAY_MILLIS = 5;
- private final int DRAG_SCROLL_PX_UNIT = 10;
+ private final int DRAG_SCROLL_PX_UNIT = 25;
private boolean mIsDragScrollerRunning = false;
private int mTouchDownForDragStartX;
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index 1c871e8..d2288e4 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -344,7 +344,7 @@
@Override
public void addView(View view) {
- view.setBackgroundResource(R.drawable.dialer_recent_card_bg);
+ view.setBackgroundResource(R.drawable.ic_tile_for_recents_and_contact_tile);
final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index 471601d..f55d4fc 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -49,12 +49,12 @@
private static final boolean DEBUG = false;
// These parameters instruct the photo manager to display the default image/letter at 70% of
- // its normal size, and vertically offset upwards 20% towards the top of the letter tile, to
+ // its normal size, and vertically offset upwards 14% towards the top of the letter tile, to
// make room for the contact name and number label at the bottom of the image.
- private static final float DEFAULT_IMAGE_LETTER_OFFSET = -0.2f;
+ private static final float DEFAULT_IMAGE_LETTER_OFFSET = -0.14f;
private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.70f;
- /** Length of all animations in miniseconds. */
+ /** Length of all animations in milliseconds. */
private int mAnimationDuration;
/** The view that holds the front layer of the favorite contact card. */
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
index 826dec0..1dbae65 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
@@ -74,9 +74,7 @@
};
private VoicemailPlaybackPresenter mPresenter;
- private static int mMediaPlayerRefCount = 0;
- private static MediaPlayerProxy mMediaPlayerInstance;
- private static ScheduledExecutorService mScheduledExecutorService;
+ private ScheduledExecutorService mScheduledExecutorService;
private View mPlaybackLayout;
@Override
@@ -89,6 +87,7 @@
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
+ mScheduledExecutorService = createScheduledExecutorService();
Bundle arguments = getArguments();
Preconditions.checkNotNull(arguments, "fragment must be started with arguments");
Uri voicemailUri = arguments.getParcelable(EXTRA_VOICEMAIL_URI);
@@ -100,8 +99,8 @@
powerManager.newWakeLock(
PowerManager.SCREEN_DIM_WAKE_LOCK, getClass().getSimpleName());
mPresenter = new VoicemailPlaybackPresenter(createPlaybackViewImpl(),
- getMediaPlayerInstance(), voicemailUri,
- getScheduledExecutorServiceInstance(), startPlayback,
+ createMediaPlayer(mScheduledExecutorService), voicemailUri,
+ mScheduledExecutorService, startPlayback,
AsyncTaskExecutors.createAsyncTaskExecutor(), wakeLock);
mPresenter.onCreate(savedInstanceState);
}
@@ -114,8 +113,8 @@
@Override
public void onDestroy() {
- shutdownMediaPlayer();
mPresenter.onDestroy();
+ mScheduledExecutorService.shutdown();
super.onDestroy();
}
@@ -130,36 +129,12 @@
mPlaybackLayout);
}
- private static synchronized MediaPlayerProxy getMediaPlayerInstance() {
- ++mMediaPlayerRefCount;
- if (mMediaPlayerInstance == null) {
- mMediaPlayerInstance = VariableSpeed.createVariableSpeed(
- getScheduledExecutorServiceInstance());
- }
- return mMediaPlayerInstance;
+ private MediaPlayerProxy createMediaPlayer(ExecutorService executorService) {
+ return VariableSpeed.createVariableSpeed(executorService);
}
- private static synchronized ScheduledExecutorService getScheduledExecutorServiceInstance() {
- if (mScheduledExecutorService == null) {
- mScheduledExecutorService = Executors.newScheduledThreadPool(
- NUMBER_OF_THREADS_IN_POOL);
- }
- return mScheduledExecutorService;
- }
-
- private static synchronized void shutdownMediaPlayer() {
- --mMediaPlayerRefCount;
- if (mMediaPlayerRefCount > 0) {
- return;
- }
- if (mScheduledExecutorService != null) {
- mScheduledExecutorService.shutdown();
- mScheduledExecutorService = null;
- }
- if (mMediaPlayerInstance != null) {
- mMediaPlayerInstance.release();
- mMediaPlayerInstance = null;
- }
+ private ScheduledExecutorService createScheduledExecutorService() {
+ return Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL);
}
/**
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
index 085ef66..ebda0eb 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
@@ -35,7 +35,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
-import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@@ -312,7 +311,6 @@
mPlayer.setDataSource(mView.getDataSourceContext(), mVoicemailUri);
mPlayer.setAudioStreamType(PLAYBACK_STREAM);
mPlayer.prepare();
- mDuration.set(mPlayer.getDuration());
return null;
} catch (Exception e) {
return e;
@@ -346,7 +344,7 @@
mView.setSpeakerPhoneOn(mView.isSpeakerPhoneOn());
mView.setRateDecreaseButtonListener(createRateDecreaseListener());
mView.setRateIncreaseButtonListener(createRateIncreaseListener());
- mView.setClipPosition(0, mDuration.get());
+ mView.setClipPosition(0, mPlayer.getDuration());
mView.playbackStopped();
// Always disable on stop.
mView.disableProximitySensor();
@@ -365,10 +363,6 @@
}
public void onDestroy() {
- if (mPrepareTask != null) {
- mPrepareTask.cancel(false);
- mPrepareTask = null;
- }
mPlayer.release();
if (mFetchResultHandler != null) {
mFetchResultHandler.destroy();
@@ -436,67 +430,49 @@
}
}
- private class AsyncPrepareTask extends AsyncTask<Void, Void, Exception> {
- private int mClipPositionInMillis;
-
- AsyncPrepareTask(int clipPositionInMillis) {
- mClipPositionInMillis = clipPositionInMillis;
- }
-
- @Override
- public Exception doInBackground(Void... params) {
- try {
- if (!mPlayer.isReadyToPlay()) {
- mPlayer.reset();
- mPlayer.setDataSource(mView.getDataSourceContext(), mVoicemailUri);
- mPlayer.setAudioStreamType(PLAYBACK_STREAM);
- mPlayer.prepare();
- }
- return null;
- } catch (Exception e) {
- return e;
- }
- }
-
- @Override
- public void onPostExecute(Exception exception) {
- mPrepareTask = null;
- if (exception == null) {
- final int duration = mPlayer.getDuration();
- mDuration.set(duration);
- int startPosition =
- constrain(mClipPositionInMillis, 0, duration);
- mPlayer.seekTo(startPosition);
- mView.setClipPosition(startPosition, duration);
- try {
- // Can throw RejectedExecutionException
- mPlayer.start();
- mView.playbackStarted();
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- }
- // Only enable if we are not currently using the speaker phone.
- if (!mView.isSpeakerPhoneOn()) {
- mView.enableProximitySensor();
- }
- // Can throw RejectedExecutionException
- mPositionUpdater.startUpdating(startPosition, duration);
- } catch (RejectedExecutionException e) {
- handleError(e);
- }
- } else {
- handleError(exception);
- }
- }
- }
-
private void resetPrepareStartPlaying(final int clipPositionInMillis) {
if (mPrepareTask != null) {
mPrepareTask.cancel(false);
- mPrepareTask = null;
}
mPrepareTask = mAsyncTaskExecutor.submit(Tasks.RESET_PREPARE_START_MEDIA_PLAYER,
- new AsyncPrepareTask(clipPositionInMillis));
+ new AsyncTask<Void, Void, Exception>() {
+ @Override
+ public Exception doInBackground(Void... params) {
+ try {
+ mPlayer.reset();
+ mPlayer.setDataSource(mView.getDataSourceContext(), mVoicemailUri);
+ mPlayer.setAudioStreamType(PLAYBACK_STREAM);
+ mPlayer.prepare();
+ return null;
+ } catch (Exception e) {
+ return e;
+ }
+ }
+
+ @Override
+ public void onPostExecute(Exception exception) {
+ mPrepareTask = null;
+ if (exception == null) {
+ mDuration.set(mPlayer.getDuration());
+ int startPosition =
+ constrain(clipPositionInMillis, 0, mDuration.get());
+ mView.setClipPosition(startPosition, mDuration.get());
+ mPlayer.seekTo(startPosition);
+ mPlayer.start();
+ mView.playbackStarted();
+ if (!mWakeLock.isHeld()) {
+ mWakeLock.acquire();
+ }
+ // Only enable if we are not currently using the speaker phone.
+ if (!mView.isSpeakerPhoneOn()) {
+ mView.enableProximitySensor();
+ }
+ mPositionUpdater.startUpdating(startPosition, mDuration.get());
+ } else {
+ handleError(exception);
+ }
+ }
+ });
}
private void handleError(Exception e) {
@@ -622,7 +598,6 @@
synchronized (mLock) {
if (mScheduledFuture != null) {
mScheduledFuture.cancel(false);
- mScheduledFuture = null;
}
mScheduledFuture = mExecutorService.scheduleAtFixedRate(this, 0, mPeriodMillis,
TimeUnit.MILLISECONDS);
@@ -645,7 +620,6 @@
}
if (mPrepareTask != null) {
mPrepareTask.cancel(false);
- mPrepareTask = null;
}
if (mWakeLock.isHeld()) {
mWakeLock.release();