Merge "Added actionbar style elements from main Dialtacts theme to "CallDetailActivityTheme" to fix issue where Call Details action bar has wrong color."
diff --git a/res/drawable-hdpi/ic_dial_action_delete.png b/res/drawable-hdpi/ic_dial_action_delete.png
index 0bf8563..ebf692a 100644
--- a/res/drawable-hdpi/ic_dial_action_delete.png
+++ b/res/drawable-hdpi/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_dial_action_delete.png b/res/drawable-mdpi/ic_dial_action_delete.png
index 98341e9..e1394c5 100644
--- a/res/drawable-mdpi/ic_dial_action_delete.png
+++ b/res/drawable-mdpi/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_dial_action_delete.png b/res/drawable-xhdpi/ic_dial_action_delete.png
index 989e8b1..6788669 100644
--- a/res/drawable-xhdpi/ic_dial_action_delete.png
+++ b/res/drawable-xhdpi/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_dial_action_delete.png b/res/drawable-xxhdpi/ic_dial_action_delete.png
index a7ff1b1..ca91a72 100644
--- a/res/drawable-xxhdpi/ic_dial_action_delete.png
+++ b/res/drawable-xxhdpi/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable/background_favorites_menu.xml b/res/drawable/background_all_contacts.xml
similarity index 86%
rename from res/drawable/background_favorites_menu.xml
rename to res/drawable/background_all_contacts.xml
index 60933fd..0d3703f 100644
--- a/res/drawable/background_favorites_menu.xml
+++ b/res/drawable/background_all_contacts.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/favorites_menu_background_color" />
+ <solid android:color="@color/all_contacts_button_color" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle" >
- <solid android:color="@color/favorites_menu_pressed_color" />
+ <solid android:color="@color/all_contacts_button_pressed_color" />
</shape>
</item>
</selector>
\ No newline at end of file
diff --git a/res/drawable/dialpad_key_colors.xml b/res/drawable/dialpad_key_colors.xml
new file mode 100644
index 0000000..27b4d4f
--- /dev/null
+++ b/res/drawable/dialpad_key_colors.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_pressed="true"
+ android:drawable="@color/background_dialpad_pressed" />
+ <item android:drawable="@color/background_dialpad" />
+</selector>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 15d7a92..e39b413 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -34,9 +34,20 @@
@id/call_log_item gone
-->
+ <!-- Linear layout to separate the primary area containing the contact badge and caller
+ information and the secondary action (call details / play voicemail). -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ >
+
+ <!-- Primary area containing the contact badge and caller information -->
<LinearLayout
android:id="@+id/primary_action_view"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="@dimen/call_log_outer_margin"
@@ -46,7 +57,7 @@
android:focusable="true"
android:nextFocusRight="@+id/secondary_action_icon"
android:nextFocusLeft="@+id/quick_contact_photo"
- >
+ >
<QuickContactBadge
android:id="@+id/quick_contact_photo"
android:layout_width="@dimen/call_log_list_contact_photo_size"
@@ -54,7 +65,7 @@
android:nextFocusRight="@id/primary_action_view"
android:layout_alignParentStart="true"
android:focusable="true"
- />
+ />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -62,7 +73,7 @@
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_marginStart="@dimen/call_log_inner_margin"
- >
+ >
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
@@ -71,12 +82,12 @@
android:textColor="?attr/call_log_primary_text_color"
android:textSize="16sp"
android:singleLine="true"
- />
+ />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
- >
+ >
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
@@ -87,13 +98,13 @@
android:singleLine="true"
android:ellipsize="marquee"
/>
- </LinearLayout>
+ </LinearLayout>
<LinearLayout
android:id="@+id/call_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
- >
+ >
<view
class="com.android.dialer.calllog.CallTypeIconsView"
android:id="@+id/call_type_icons"
@@ -101,7 +112,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/call_log_icon_margin"
android:layout_gravity="center_vertical"
- />
+ />
<TextView
android:id="@+id/call_count_and_date"
android:layout_width="wrap_content"
@@ -111,43 +122,43 @@
android:textColor="?attr/call_log_secondary_text_color"
android:textSize="12sp"
android:singleLine="true"
- />
+ />
</LinearLayout>
</LinearLayout>
- <!-- Linear layout to house a vertical separator line and the
- secondary action button. Used as a convenience to hide both
- the separator and action button at the same time. -->
- <LinearLayout
- android:id="@+id/secondary_action_view"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- >
- <!-- Thin vertical divider to visually separate the secondary action button -->
- <View
- android:id="@+id/vertical_divider"
- android:layout_width="@dimen/call_log_list_item_vertical_divider_width"
- android:layout_height="match_parent"
- android:layout_marginTop="@dimen/call_log_list_item_vertical_divider_margin"
- android:layout_marginBottom="@dimen/call_log_list_item_vertical_divider_margin"
- android:background="?android:attr/dividerVertical"/>
- <!-- The secondary action button; either play voicemail or call details. -->
- <ImageButton
- android:id="@+id/secondary_action_icon"
- android:layout_width="@dimen/call_log_call_action_width"
- 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"
- />
- </LinearLayout>
</LinearLayout>
-
+ <!-- Linear layout to house a vertical separator line and the secondary action button.
+ Used as a convenience to hide both the separator and action button at the same
+ time. -->
+ <LinearLayout
+ android:id="@+id/secondary_action_view"
+ android:layout_width="@dimen/call_log_call_action_width"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ >
+ <!-- Thin vertical divider to visually separate the secondary action button -->
+ <View
+ android:id="@+id/vertical_divider"
+ android:layout_width="@dimen/call_log_list_item_vertical_divider_width"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/call_log_list_item_vertical_divider_margin"
+ android:layout_marginBottom="@dimen/call_log_list_item_vertical_divider_margin"
+ android:background="?android:attr/dividerVertical"/>
+ <!-- The secondary action button; either play voicemail or call details. -->
+ <ImageButton
+ android:id="@+id/secondary_action_icon"
+ android:layout_width="match_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"
+ />
+ </LinearLayout>
+ </LinearLayout>
<TextView
android:id="@+id/call_log_header"
style="@style/ContactListSeparatorTextViewStyle"
diff --git a/res/layout/dialpad.xml b/res/layout/dialpad.xml
index 4fc3e83..c3db420 100644
--- a/res/layout/dialpad.xml
+++ b/res/layout/dialpad.xml
@@ -19,42 +19,26 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialpad"
android:layout_width="match_parent"
- android:layout_height="0px"
- android:layout_weight="@integer/dialpad_layout_weight_dialpad"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/dialpad_vertical_margin"
- android:paddingStart="5dip"
- android:paddingEnd="5dip"
- android:paddingBottom="10dip"
- android:stretchColumns="0,1,2"
+ android:layout_height="wrap_content"
+ android:paddingLeft="5dp"
+ android:paddingRight="5dp"
+ android:background="@android:color/transparent"
+ android:stretchColumns="*"
android:layoutDirection="ltr" >
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
+ <TableRow>
<com.android.dialer.dialpad.DialpadKeyButton
- xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/one"
- style="@style/DialtactsDialpadButtonStyle"
- android:clickable="true"
- android:focusable="true" >
+ style="@style/DialpadKeyButtonStyle">
<LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center" >
+ style="@style/DialpadKeyInternalLayoutStyle">
<TextView
android:id="@+id/dialpad_key_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/dialpad_primary_text_color"
- android:textSize="@dimen/dialpad_key_numbers_size"
- android:fontFamily="sans-serif-light"/>
+ style="@style/DialpadKeyNumberStyle"/>
<ImageView
android:id="@+id/dialpad_key_voicemail"
- android:layout_width="@dimen/dialpad_key_letters_width"
- android:layout_height="wrap_content"
+ style="@style/DialpadKeyLettersStyle"
android:src="@drawable/ic_dial_action_vm"
- android:paddingLeft="11dp"
android:scaleType="fitStart"
android:baselineAlignBottom="true" />
</LinearLayout>
@@ -63,57 +47,45 @@
<include layout="@layout/dialpad_key" android:id="@+id/three"/>
</TableRow>
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
+ <TableRow>
<include layout="@layout/dialpad_key" android:id="@+id/four"/>
<include layout="@layout/dialpad_key" android:id="@+id/five"/>
<include layout="@layout/dialpad_key" android:id="@+id/six"/>
</TableRow>
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
+ <TableRow>
<include layout="@layout/dialpad_key" android:id="@+id/seven"/>
<include layout="@layout/dialpad_key" android:id="@+id/eight"/>
<include layout="@layout/dialpad_key" android:id="@+id/nine"/>
</TableRow>
- <TableRow
- android:layout_height="0px"
- android:layout_weight="1">
+ <TableRow>
<com.android.dialer.dialpad.DialpadKeyButton
- xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/star"
- style="@style/DialtactsDialpadButtonStyle"
- android:clickable="true"
- android:focusable="true" >
- <TextView
- android:id="@id/dialpad_key_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/dialpad_secondary_text_color"
- android:textSize="@dimen/dialpad_key_special_characters_size"
- android:fontFamily="sans-serif-light"
- android:paddingRight="@dimen/dialpad_key_letters_width"
- android:layout_gravity="center" />
+ style="@style/DialpadKeyButtonStyle">
+ <LinearLayout
+ style="@style/DialpadKeyInternalLayoutStyle">
+ <TextView
+ android:id="@id/dialpad_key_number"
+ style="@style/DialpadKeyStarPoundStyle" />
+ <View
+ android:layout_height="match_parent"
+ android:layout_width="@dimen/dialpad_key_letters_width" />
+ </LinearLayout>
</com.android.dialer.dialpad.DialpadKeyButton>
<include layout="@layout/dialpad_key" android:id="@+id/zero"/>
<com.android.dialer.dialpad.DialpadKeyButton
- xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pound"
- style="@style/DialtactsDialpadButtonStyle"
- android:clickable="true"
- android:focusable="true" >
- <TextView
- android:id="@id/dialpad_key_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/dialpad_secondary_text_color"
- android:textSize="@dimen/dialpad_key_special_characters_size"
- android:fontFamily="sans-serif-light"
- android:paddingRight="@dimen/dialpad_key_letters_width"
- android:layout_gravity="center" />
+ style="@style/DialpadKeyButtonStyle">
+ <LinearLayout
+ style="@style/DialpadKeyInternalLayoutStyle">
+ <TextView
+ android:id="@id/dialpad_key_number"
+ style="@style/DialpadKeyStarPoundStyle" />
+ <View
+ android:layout_height="match_parent"
+ android:layout_width="@dimen/dialpad_key_letters_width" />
+ </LinearLayout>
</com.android.dialer.dialpad.DialpadKeyButton>
</TableRow>
</TableLayout>
diff --git a/res/layout/dialpad_chooser_list_item.xml b/res/layout/dialpad_chooser_list_item.xml
index 5ba88ca..9a49036 100644
--- a/res/layout/dialpad_chooser_list_item.xml
+++ b/res/layout/dialpad_chooser_list_item.xml
@@ -27,7 +27,7 @@
<TextView android:id="@+id/text"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/dialpad_text_color"
+ android:textColor="@color/dialpad_primary_text_color"
android:layout_gravity="center_vertical"
android:layout_width="0dip"
android:layout_weight="1"
diff --git a/res/layout/dialpad_digits.xml b/res/layout/dialpad_digits.xml
new file mode 100644
index 0000000..21638f0
--- /dev/null
+++ b/res/layout/dialpad_digits.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<!-- Text field and possibly soft menu button above the keypad where
+ the digits are displayed. -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/digits_container"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dialpad_digits_height"
+ android:orientation="horizontal">
+
+ <view class="com.android.dialer.dialpad.DigitsEditText"
+ android:id="@+id/digits"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:paddingLeft="@dimen/dialpad_digits_padding"
+ android:scrollHorizontally="true"
+ android:singleLine="true"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:background="@android:color/transparent"
+ android:maxLines="1"
+ android:textSize="@dimen/dialpad_digits_text_size"
+ android:freezesText="true"
+ android:focusableInTouchMode="true"
+ android:editable="true"
+ android:cursorVisible="false"
+ android:textColor="@color/dialpad_digits_text_color"
+ android:textCursorDrawable="@null"
+ android:fontFamily="sans-serif-light"
+ android:textStyle="normal" />
+
+ <ImageButton
+ android:id="@+id/deleteButton"
+ android:paddingLeft="@dimen/dialpad_digits_padding"
+ android:paddingRight="@dimen/dialpad_digits_padding"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:state_enabled="false"
+ android:background="@drawable/dialpad_key_colors"
+ android:contentDescription="@string/description_delete_button"
+ android:src="@drawable/ic_dial_action_delete" />
+</LinearLayout>
diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml
index e673cea..239f727 100644
--- a/res/layout/dialpad_fragment.xml
+++ b/res/layout/dialpad_fragment.xml
@@ -16,103 +16,51 @@
<view class="com.android.dialer.dialpad.DialpadFragment$DialpadSlidingLinearLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- spacer view -->
<View
android:id="@+id/spacer"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_weight="1" />
+ android:layout_weight="1"
+ android:background="#00000000" />
+
<view class="com.android.dialer.dialpad.DialpadFragment$HoverIgnoringLinearLayout"
android:id="@+id/top"
+ android:animateLayoutChanges="true"
+ android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="2"
+ android:layout_gravity="bottom"
android:orientation="vertical"
- android:paddingStart="@dimen/dialpad_horizontal_margin"
- android:paddingEnd="@dimen/dialpad_horizontal_margin"
android:layoutDirection="ltr"
- android:background="@color/background_dialpad" >
+ android:background="@color/background_dialpad">
-
- <!-- Text field and possibly soft menu button above the keypad where
- the digits are displayed. -->
- <LinearLayout
- android:id="@+id/digits_container"
+ <Space
android:layout_width="match_parent"
- android:layout_height="0px"
- android:layout_weight="@integer/dialpad_layout_weight_digits"
- android:layout_marginTop="@dimen/dialpad_vertical_margin"
- android:gravity="center" >
+ android:layout_height="2dp"
+ android:background="@color/dialpad_separator_line_color" />
- <com.android.dialer.dialpad.DigitsEditText
- android:id="@+id/digits"
- android:layout_width="0dip"
- android:layout_weight="1"
- android:layout_height="match_parent"
- android:paddingLeft="10dp"
- android:gravity="center"
- android:scrollHorizontally="true"
- android:singleLine="true"
- android:textAppearance="@style/DialtactsDigitsTextAppearance"
- android:textColor="@color/dialpad_text_color"
- android:textCursorDrawable="@null"
- android:fontFamily="sans-serif-light"
- android:nextFocusRight="@+id/overflow_menu"
- android:background="@android:color/transparent" />
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="10dp" />
- <ImageButton
- android:id="@+id/deleteButton"
- android:layout_width="56dip"
- android:layout_height="match_parent"
- android:layout_gravity="center_vertical"
- android:gravity="center"
- android:state_enabled="false"
- android:background="?android:attr/selectableItemBackground"
- android:contentDescription="@string/description_delete_button"
- android:src="@drawable/ic_dial_action_delete" />
- </LinearLayout>
+ <include layout="@layout/dialpad_digits"/>
- <!-- Keypad section -->
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="8dp" />
+
<include layout="@layout/dialpad" />
- <View style="@style/DialpadHorizontalSeparator"/>
-
- <LinearLayout
- android:id="@+id/dialButtonContainer"
+ <Space
android:layout_width="match_parent"
- android:layout_height="@dimen/fake_action_bar_height"
- android:layout_gravity="center_horizontal"
- android:background="@color/dialpad_primary_text_color"
- android:layoutDirection="locale">
- <ImageButton
- android:id="@+id/call_history_on_dialpad_button"
- android:layout_height="match_parent"
- android:layout_width="@dimen/fake_menu_button_min_width"
- android:layout_gravity="bottom|start"
- android:background="@drawable/btn_call"
- android:contentDescription="@string/action_menu_call_history_description"
- android:src="@drawable/ic_menu_history_lt"/>
- <ImageButton
- android:id="@+id/dialButton"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:state_enabled="false"
- android:background="@drawable/btn_call"
- android:contentDescription="@string/description_dial_button"
- android:src="@drawable/ic_dial_action_call" />
- <ImageButton
- android:id="@+id/overflow_menu_on_dialpad"
- android:layout_height="match_parent"
- android:layout_width="@dimen/fake_menu_button_min_width"
- android:layout_gravity="bottom|end"
- android:background="@drawable/btn_call"
- android:src="@drawable/ic_menu_overflow_lt"
- android:contentDescription="@string/action_menu_overflow_description" />
- </LinearLayout>
+ android:layout_height="8dp" />
+
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="2dp"
+ android:background="@color/dialpad_separator_line_color" />
<!-- "Dialpad chooser" UI, shown only when the user brings up the
Dialer while a call is already in progress.
@@ -120,9 +68,9 @@
(the textfield/button and the dialpad) are hidden. -->
<ListView android:id="@+id/dialpadChooser"
android:layout_width="match_parent"
- android:layout_height="1dip"
+ android:layout_height="wrap_content"
android:layout_weight="1"
- />
+ android:visibility="gone" />
</view>
</view>
diff --git a/res/layout/dialpad_key.xml b/res/layout/dialpad_key.xml
index c104f8a..5bf858c 100644
--- a/res/layout/dialpad_key.xml
+++ b/res/layout/dialpad_key.xml
@@ -17,29 +17,19 @@
<!-- A layout representing a single key in the dialpad -->
<com.android.dialer.dialpad.DialpadKeyButton
xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/DialtactsDialpadButtonStyle"
- android:clickable="true"
- android:focusable="true" >
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center">
- <TextView
- android:id="@+id/dialpad_key_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/dialpad_primary_text_color"
- android:textSize="@dimen/dialpad_key_numbers_size"
- android:fontFamily="sans-serif-light"
- />
- <TextView
- android:id="@+id/dialpad_key_letters"
- android:layout_width="@dimen/dialpad_key_letters_width"
- android:layout_height="wrap_content"
- android:textColor="@color/dialpad_secondary_text_color"
- android:textSize="@dimen/dialpad_key_letters_size"
- android:paddingLeft="11dp"
- android:fontFamily="sans-serif-light"
- />
+ style="@style/DialpadKeyButtonStyle">
+
+ <LinearLayout style="@style/DialpadKeyInternalLayoutStyle">
+
+ <!-- Note in the referenced styles that we assign hard widths to these components
+ because we want them to line up vertically when we arrange them in an MxN grid -->
+
+ <TextView
+ android:id="@+id/dialpad_key_number"
+ style="@style/DialpadKeyNumberStyle" />
+
+ <TextView
+ android:id="@+id/dialpad_key_letters"
+ style="@style/DialpadKeyLettersStyle" />
</LinearLayout>
</com.android.dialer.dialpad.DialpadKeyButton>
\ No newline at end of file
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index 1a1a0b0..6eea633 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -13,159 +13,180 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<FrameLayout
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
+ android:orientation="vertical"
android:focusableInTouchMode="true"
android:clipChildren="false"
- android:id="@+id/dialtacts_container"
>
- <!-- Overlapping dialpad fragment is inserted here -->
- <LinearLayout
+
+ <FrameLayout
+ android:id="@+id/dialtacts_container"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipChildren="false"
- android:orientation="vertical" >
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- >
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="@dimen/search_box_height"
- android:id="@+id/search_view_container"
- android:orientation="horizontal"
- android:layout_marginTop="@dimen/search_top_margin"
- android:layout_marginBottom="@dimen/search_bottom_margin"
- android:layout_marginLeft="@dimen/search_margin_horizontal"
- android:layout_marginRight="@dimen/search_margin_horizontal"
- android:paddingLeft="@dimen/search_box_left_padding"
- android:paddingRight="@dimen/search_box_right_padding"
- android:background="@drawable/search_bg"
- android:gravity="center_vertical"
- >
- <EditText
- android:id="@+id/search_view"
- android:layout_width="match_parent"
- android:layout_height="@dimen/search_box_icon_size"
- android:layout_weight="1"
- android:layout_marginLeft="@dimen/search_box_text_left_margin"
- android:textSize="@dimen/search_text_size"
- android:fontFamily="@string/search_font_family"
- android:textColor="@color/searchbox_text_color"
- android:inputType="textFilter"/>
- <ImageView
- android:id="@+id/search_close_button"
- android:layout_height="@dimen/search_box_icon_size"
- android:layout_width="@dimen/search_box_icon_size"
- android:padding="6dp"
- android:src="@drawable/ic_close_dk"
- android:clickable="true"
- android:background="?android:attr/selectableItemBackground"
- android:contentDescription="@string/description_clear_search"
- android:visibility="gone" />
- <ImageView
- android:id="@+id/voice_search_button"
- android:layout_height="@dimen/search_box_icon_size"
- android:layout_width="@dimen/search_box_icon_size"
- android:padding="@dimen/search_box_icon_padding"
- android:src="@drawable/ic_voice_search"
- android:clickable="true"
- android:contentDescription="@string/description_start_voice_search"
- android:background="?android:attr/selectableItemBackground" />
- </LinearLayout>
- <com.android.dialer.list.RemoveView
- android:layout_width="match_parent"
- android:layout_height="56dp"
- android:id="@+id/remove_view_container"
- android:orientation="horizontal"
- android:gravity="center"
- 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"
- />
- </com.android.dialer.list.RemoveView>
- </FrameLayout>
+ android:layout_height="0dp"
+ android:layout_weight="1">
- <!-- Relative Layout is used to contain the main contacts grid and the thin translucent
- horizontal divider line at the bottom of the contacts grid above the menu bar. -->
- <RelativeLayout android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:clipChildren="false"
- >
- <!-- The main contacts grid -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:orientation="vertical" >
+
+ <!-- Search entry box and remove view -->
<FrameLayout
- android:layout_height="match_parent"
android:layout_width="match_parent"
- android:id="@+id/dialtacts_frame"
- android:clipChildren="false"
- android:layout_alignParentBottom="true"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
+ android:layout_height="wrap_content"
+ android:id="@+id/search_and_remove_view_container"
>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/search_box_height"
+ android:id="@+id/search_view_container"
+ android:orientation="horizontal"
+ android:layout_marginTop="@dimen/search_top_margin"
+ android:layout_marginBottom="@dimen/search_bottom_margin"
+ android:layout_marginLeft="@dimen/search_margin_horizontal"
+ android:layout_marginRight="@dimen/search_margin_horizontal"
+ android:paddingLeft="@dimen/search_box_left_padding"
+ android:paddingRight="@dimen/search_box_right_padding"
+ android:background="@drawable/search_bg"
+ android:gravity="center_vertical"
+ >
+ <EditText
+ android:id="@+id/search_view"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/search_box_icon_size"
+ android:layout_weight="1"
+ android:layout_marginLeft="@dimen/search_box_text_left_margin"
+ android:textSize="@dimen/search_text_size"
+ android:fontFamily="@string/search_font_family"
+ android:textColor="@color/searchbox_text_color"
+ android:inputType="textFilter"/>
+ <ImageView
+ android:id="@+id/search_close_button"
+ android:layout_height="@dimen/search_box_icon_size"
+ android:layout_width="@dimen/search_box_icon_size"
+ android:padding="6dp"
+ android:src="@drawable/ic_close_dk"
+ android:clickable="true"
+ android:background="?android:attr/selectableItemBackground"
+ android:contentDescription="@string/description_clear_search"
+ android:visibility="gone" />
+ <ImageView
+ android:id="@+id/voice_search_button"
+ android:layout_height="@dimen/search_box_icon_size"
+ android:layout_width="@dimen/search_box_icon_size"
+ android:padding="@dimen/search_box_icon_padding"
+ android:src="@drawable/ic_voice_search"
+ android:clickable="true"
+ android:contentDescription="@string/description_start_voice_search"
+ android:background="?android:attr/selectableItemBackground" />
+ </LinearLayout>
+ <com.android.dialer.list.RemoveView
+ android:layout_width="match_parent"
+ android:layout_height="56dp"
+ android:id="@+id/remove_view_container"
+ android:orientation="horizontal"
+ android:gravity="center"
+ 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"
+ />
+ </com.android.dialer.list.RemoveView>
</FrameLayout>
- <!-- Thin translucent horizontal line at the bottom of the contacts grid. Floats above
- the contacts grid and has a translucent color. -->
- <View
- android:layout_height="2dp"
- android:layout_width="match_parent"
- android:background="@color/contacts_grid_bottom_border_color"
- android:layout_alignParentBottom="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentRight="true"
- />
- </RelativeLayout>
- <FrameLayout
- android:layout_height="@dimen/fake_action_bar_height"
- android:layout_width="match_parent"
- 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"
- android:layout_height="match_parent"
- android:layout_gravity="bottom|start"
- android:background="?android:attr/selectableItemBackground"
- android:contentDescription="@string/action_menu_call_history_description"
- android:src="@drawable/ic_menu_history_lt"/>
- <ImageButton
- android:id="@+id/dialpad_button"
- android:layout_width="@dimen/fake_menu_button_min_width"
- android:layout_height="match_parent"
- android:layout_gravity="bottom|center"
- android:background="?android:attr/selectableItemBackground"
- android:contentDescription="@string/action_menu_dialpad_button"
- android:src="@drawable/ic_menu_dialpad_lt"/>
- <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_lt"
- android:contentDescription="@string/action_menu_overflow_description"
- android:background="?android:attr/selectableItemBackground"/>
- </FrameLayout>
- <View
- android:id="@+id/dialtacts_bottom_padding"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/actionBarSize"
+ <!-- Relative Layout is used to contain the main contacts grid and the thin translucent
+ horizontal divider line at the bottom of the contacts grid above the menu bar. -->
+ <RelativeLayout android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:clipChildren="false"
+ >
+ <!-- The main contacts grid -->
+ <FrameLayout
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:id="@+id/dialtacts_frame"
+ android:clipChildren="false"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentRight="true"
+ >
+ </FrameLayout>
+ <!-- Thin translucent horizontal line at the bottom of the contacts grid. Floats
+ above the contacts grid and has a translucent color. -->
+ <View
+ android:layout_height="2dp"
+ android:layout_width="match_parent"
+ android:background="@color/contacts_grid_bottom_border_color"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentRight="true"
+ />
+ </RelativeLayout>
+ <Space
+ android:id="@+id/contact_tile_frame_spacer"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_alignParentBottom="true"
+ android:visibility="gone"/>
+ </LinearLayout>
+ </FrameLayout>
+
+ <!-- Fake action bar -->
+ <FrameLayout
+ android:layout_height="@dimen/fake_action_bar_height"
+ android:layout_width="match_parent"
+ 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"
+ android:layout_height="match_parent"
+ android:layout_gravity="bottom|start"
+ android:background="?android:attr/selectableItemBackground"
+ android:contentDescription="@string/action_menu_call_history_description"
+ android:src="@drawable/ic_menu_history_lt"/>
+ <ImageButton
+ android:id="@+id/dialpad_button"
+ android:layout_width="@dimen/fake_menu_button_min_width"
+ android:layout_height="match_parent"
+ android:layout_gravity="bottom|center"
+ android:background="?android:attr/selectableItemBackground"
+ android:contentDescription="@string/action_menu_dialpad_button"
+ android:src="@drawable/ic_menu_dialpad_lt"/>
+ <ImageButton
+ android:id="@+id/dial_button"
+ android:layout_width="@dimen/fake_menu_button_min_width"
+ android:layout_height="match_parent"
+ android:layout_gravity="bottom|center"
+ android:background="@drawable/btn_call"
+ android:contentDescription="@string/description_dial_button"
+ android:src="@drawable/ic_dial_action_call"
android:visibility="gone" />
- </LinearLayout>
-</FrameLayout>
+ <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_lt"
+ android:contentDescription="@string/action_menu_overflow_description"
+ android:background="?android:attr/selectableItemBackground"/>
+ </FrameLayout>
+</LinearLayout>
diff --git a/res/layout/phone_favorite_regular_row_view.xml b/res/layout/phone_favorite_regular_row_view.xml
index 0d131f6..d046fdb 100644
--- a/res/layout/phone_favorite_regular_row_view.xml
+++ b/res/layout/phone_favorite_regular_row_view.xml
@@ -65,18 +65,6 @@
android:singleLine="true"
android:textColor="@color/dialtacts_secondary_text_color" />
</LinearLayout>
- <ImageView
- android:id="@+id/contact_favorite_star"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignRight="@id/contact_tile_quick"
- android:layout_alignEnd="@id/contact_tile_quick"
- android:layout_alignBottom="@id/contact_tile_quick"
- android:layout_marginRight="7dip"
- android:layout_marginEnd="7dip"
- android:layout_marginBottom="7dip"
- android:src="@drawable/star_thumbnail"
- android:visibility="gone" />
</RelativeLayout>
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml
index c4ad780..8562b36 100644
--- a/res/layout/phone_favorite_tile_view.xml
+++ b/res/layout/phone_favorite_tile_view.xml
@@ -85,26 +85,6 @@
android:nextFocusRight="@+id/contact_tile_secondary_button"
android:background="?android:attr/selectableItemBackground" />
- <ImageView
- android:id="@+id/contact_favorite_star"
- android:background="?android:attr/selectableItemBackground"
- android:layout_height="@dimen/contact_tile_info_button_height_and_width"
- android:layout_width="@dimen/contact_tile_info_button_height_and_width"
- android:paddingLeft="2dp"
- android:paddingRight="2dp"
- android:paddingStart="2dp"
- android:paddingEnd="2dp"
- android:paddingTop="2dp"
- android:paddingBottom="2dp"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"
- android:layout_alignParentEnd="true"
- android:src="@drawable/star_thumbnail"
- android:scaleType="center"
- android:contentDescription="@string/description_view_contact_detail"
- android:visibility="gone" />
-
-
<ImageButton
android:id="@id/contact_tile_secondary_button"
android:src="@drawable/overflow_thumbnail"
diff --git a/res/layout/phone_favorites_fragment.xml b/res/layout/phone_favorites_fragment.xml
index 23987a8..d1ff3d7 100644
--- a/res/layout/phone_favorites_fragment.xml
+++ b/res/layout/phone_favorites_fragment.xml
@@ -58,5 +58,4 @@
android:layout_alignParentBottom="true"
layout="@layout/phone_no_favorites"
android:visibility="gone"/>
-
</RelativeLayout>
diff --git a/res/layout/phone_favorites_menu.xml b/res/layout/phone_favorites_menu.xml
index 5f7a5a6..387ea5b 100644
--- a/res/layout/phone_favorites_menu.xml
+++ b/res/layout/phone_favorites_menu.xml
@@ -25,8 +25,7 @@
android:paddingRight="@dimen/favorites_menu_padding_horizontal"
android:paddingTop="@dimen/favorites_menu_padding_top"
android:paddingBottom="@dimen/favorites_menu_padding_bottom"
- android:background="@drawable/background_favorites_menu"
- android:addStatesFromChildren="true"
+ android:background="@color/favorites_menu_background_color"
>
<TextView
android:layout_width="wrap_content"
@@ -39,7 +38,7 @@
android:layout_centerVertical="true"
android:gravity="center"
/>
- <TextView
+ <Button
android:id="@+id/all_contacts_button"
android:fontFamily="@string/favorites_menu_all_contacts_font_family"
android:layout_width="wrap_content"
@@ -48,11 +47,10 @@
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="@color/all_contacts_button_color"
+ android:background="@drawable/background_all_contacts"
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/layout/phone_no_favorites.xml b/res/layout/phone_no_favorites.xml
index 1a0079f..b95afd1 100644
--- a/res/layout/phone_no_favorites.xml
+++ b/res/layout/phone_no_favorites.xml
@@ -18,7 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical"
android:minHeight="?android:attr/listPreferredItemHeight">
<include
@@ -33,23 +32,18 @@
<LinearLayout
android:id="@+id/nofavorite_frame"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical"
- android:layout_gravity="center"
android:gravity="center"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- android:layout_above="@id/show_all_contact_button_in_nofav">
-
+ android:layout_centerInParent="true">
<ImageView
android:id="@+id/nofavorite_image"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:src="@drawable/no_favorites_banner"
- android:layout_marginBottom="14dp"/>
-
+ android:layout_marginBottom="14dp"
+ android:contentDescription="@string/no_favorites"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
diff --git a/res/layout/tile_interactions_teaser_view.xml b/res/layout/tile_interactions_teaser_view.xml
index 4104446..8204cb1 100644
--- a/res/layout/tile_interactions_teaser_view.xml
+++ b/res/layout/tile_interactions_teaser_view.xml
@@ -18,7 +18,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/actionbar_background_color"
+ android:background="@color/background_dialer_list_items"
android:paddingBottom="@dimen/favorites_row_bottom_padding"
android:paddingTop="@dimen/favorites_row_top_padding">
diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml
index 57cf883..bd949b5 100644
--- a/res/values-fi/strings.xml
+++ b/res/values-fi/strings.xml
@@ -125,8 +125,7 @@
<string name="description_call_last" msgid="491385778814705302">"Soita <xliff:g id="NAMEORNUMBER">%1$s</xliff:g> <xliff:g id="TYPEORLOCATION">%2$s</xliff:g>. Soitettiin <xliff:g id="TIMEOFCALL">%3$s</xliff:g>."</string>
<string name="description_send_text_message" msgid="7803126439934046891">"Lähetä tekstiviesti: <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="description_call_log_unheard_voicemail" msgid="118101684236996786">"Kuuntelematon vastaajaviesti"</string>
- <!-- no translation found for description_clear_search (688023606766232904) -->
- <skip />
+ <string name="description_clear_search" msgid="688023606766232904">"Tyhjennä haku"</string>
<string name="description_start_voice_search" msgid="520539488194946012">"Aloita puhehaku"</string>
<string name="menu_callNumber" msgid="997146291983360266">"Soita <xliff:g id="NUMBER">%s</xliff:g>"</string>
<string name="unknown" msgid="740067747858270469">"Tuntematon"</string>
@@ -174,10 +173,7 @@
<string name="no_favorites" msgid="5212485868783382971">"Suosikit ja yhteyshenkilöt, joille\nsoitat usein, näkyvät tässä.\nAla siis soitella."</string>
<string name="contact_tooltip" msgid="7817483485692282287">"Napauta kuvaa nähdäksesi kaikki numerot tai järjestä uudelleen painamalla pitkään"</string>
<string name="description_dismiss" msgid="2146276780562549643">"Ohita"</string>
- <!-- no translation found for remove_contact (1080555335283662961) -->
- <skip />
- <!-- no translation found for favorites_menu_speed_dial (3832518092014707628) -->
- <skip />
- <!-- no translation found for favorites_menu_all_contacts (992506284449891186) -->
- <skip />
+ <string name="remove_contact" msgid="1080555335283662961">"Poista"</string>
+ <string name="favorites_menu_speed_dial" msgid="3832518092014707628">"Pikavalinta"</string>
+ <string name="favorites_menu_all_contacts" msgid="992506284449891186">"KAIKKI YHTEYSTIEDOT"</string>
</resources>
diff --git a/res/values-ms-rMY/strings.xml b/res/values-ms-rMY/strings.xml
index eac67ec..1c01456 100644
--- a/res/values-ms-rMY/strings.xml
+++ b/res/values-ms-rMY/strings.xml
@@ -125,8 +125,7 @@
<string name="description_call_last" msgid="491385778814705302">"Panggil <xliff:g id="NAMEORNUMBER">%1$s</xliff:g> <xliff:g id="TYPEORLOCATION">%2$s</xliff:g>. Dipanggil <xliff:g id="TIMEOFCALL">%3$s</xliff:g>."</string>
<string name="description_send_text_message" msgid="7803126439934046891">"Hantar mesej teks kepada <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="description_call_log_unheard_voicemail" msgid="118101684236996786">"Mel suara belum didengar"</string>
- <!-- no translation found for description_clear_search (688023606766232904) -->
- <skip />
+ <string name="description_clear_search" msgid="688023606766232904">"Kosongkan carian"</string>
<string name="description_start_voice_search" msgid="520539488194946012">"Mulakan carian suara"</string>
<string name="menu_callNumber" msgid="997146291983360266">"Panggil <xliff:g id="NUMBER">%s</xliff:g>"</string>
<string name="unknown" msgid="740067747858270469">"Tidak diketahui"</string>
@@ -174,10 +173,7 @@
<string name="no_favorites" msgid="5212485868783382971">"Kegemaran & kenalan yang\nkerap anda hubungi akan ditunjukkan di sini.\nJadi, mulalah membuat panggilan."</string>
<string name="contact_tooltip" msgid="7817483485692282287">"Ketik imej untuk melihat semua nombor atau tekan dan tahan imej untuk menyusun semula"</string>
<string name="description_dismiss" msgid="2146276780562549643">"Ketepikan"</string>
- <!-- no translation found for remove_contact (1080555335283662961) -->
- <skip />
- <!-- no translation found for favorites_menu_speed_dial (3832518092014707628) -->
- <skip />
- <!-- no translation found for favorites_menu_all_contacts (992506284449891186) -->
- <skip />
+ <string name="remove_contact" msgid="1080555335283662961">"Alih keluar"</string>
+ <string name="favorites_menu_speed_dial" msgid="3832518092014707628">"Dail Laju"</string>
+ <string name="favorites_menu_all_contacts" msgid="992506284449891186">"SEMUA KENALAN"</string>
</resources>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index cdfd4ad..29659b6 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -174,6 +174,6 @@
<string name="contact_tooltip" msgid="7817483485692282287">"Trykk på bildet for å se alle telefonnumrene, eller trykk og hold inne for å endre rekkefølgen"</string>
<string name="description_dismiss" msgid="2146276780562549643">"Fjern"</string>
<string name="remove_contact" msgid="1080555335283662961">"Fjern"</string>
- <string name="favorites_menu_speed_dial" msgid="3832518092014707628">"Hurtigvalg"</string>
+ <string name="favorites_menu_speed_dial" msgid="3832518092014707628">"Hurtigoppringing"</string>
<string name="favorites_menu_all_contacts" msgid="992506284449891186">"ALLE KONTAKTER"</string>
</resources>
diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
index cf0fc74..d3fb399 100644
--- a/res/values-ro/strings.xml
+++ b/res/values-ro/strings.xml
@@ -125,8 +125,7 @@
<string name="description_call_last" msgid="491385778814705302">"Sunați la <xliff:g id="NAMEORNUMBER">%1$s</xliff:g> <xliff:g id="TYPEORLOCATION">%2$s</xliff:g>. Ora apelului: <xliff:g id="TIMEOFCALL">%3$s</xliff:g>."</string>
<string name="description_send_text_message" msgid="7803126439934046891">"Trimiteţi un mesaj text către <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="description_call_log_unheard_voicemail" msgid="118101684236996786">"Mesaje vocale neascultate"</string>
- <!-- no translation found for description_clear_search (688023606766232904) -->
- <skip />
+ <string name="description_clear_search" msgid="688023606766232904">"Ștergeți căutarea"</string>
<string name="description_start_voice_search" msgid="520539488194946012">"Începeţi căutarea vocală"</string>
<string name="menu_callNumber" msgid="997146291983360266">"Apelaţi <xliff:g id="NUMBER">%s</xliff:g>"</string>
<string name="unknown" msgid="740067747858270469">"Necunoscut"</string>
@@ -174,10 +173,7 @@
<string name="no_favorites" msgid="5212485868783382971">"Preferințele și persoanele din Agendă pe care \nle apelați frecvent vor fi afișate aici.\nÎncepeți să faceți apeluri."</string>
<string name="contact_tooltip" msgid="7817483485692282287">"Atingeți imaginea pentru a vedea toate numerele sau apăsați și țineți apăsat pentru a reordona"</string>
<string name="description_dismiss" msgid="2146276780562549643">"Închideți"</string>
- <!-- no translation found for remove_contact (1080555335283662961) -->
- <skip />
- <!-- no translation found for favorites_menu_speed_dial (3832518092014707628) -->
- <skip />
- <!-- no translation found for favorites_menu_all_contacts (992506284449891186) -->
- <skip />
+ <string name="remove_contact" msgid="1080555335283662961">"Eliminați"</string>
+ <string name="favorites_menu_speed_dial" msgid="3832518092014707628">"Apelare rapidă"</string>
+ <string name="favorites_menu_all_contacts" msgid="992506284449891186">"TOATĂ AGENDA"</string>
</resources>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index a923087..a13b125 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -173,7 +173,7 @@
<string name="no_favorites" msgid="5212485868783382971">"您收藏的联系人和经常通话\n的联系人都会显示在这里。\n现在就开始与联系人通话吧。"</string>
<string name="contact_tooltip" msgid="7817483485692282287">"点按图片可查看所有号码,按住图片可重新排序"</string>
<string name="description_dismiss" msgid="2146276780562549643">"关闭"</string>
- <string name="remove_contact" msgid="1080555335283662961">"删除"</string>
+ <string name="remove_contact" msgid="1080555335283662961">"移除"</string>
<string name="favorites_menu_speed_dial" msgid="3832518092014707628">"快速拨号"</string>
<string name="favorites_menu_all_contacts" msgid="992506284449891186">"所有联系人"</string>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index cbcfd72..2fb59ed 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -19,7 +19,19 @@
<!-- Secondary text color in the Phone app -->
<color name="dialtacts_primary_text_color">#000000</color>
<color name="dialtacts_secondary_text_color">#888888</color>
- <color name="dialpad_text_color">#ffffff</color>
+
+ <!-- Background color of dialpad -->
+ <color name="background_dialpad">#ffffff</color>
+ <!-- Pressed color of dialpad buttons -->
+ <color name="background_dialpad_pressed">#ececec</color>
+ <!-- Primary color of dialpad text, including the call button -->
+ <color name="dialpad_primary_text_color">#3B77E7</color>
+ <!-- Secondary color of dialpad text (used for the letters corresponding to each digit -->
+ <color name="dialpad_secondary_text_color">#8b8b8b</color>
+ <!-- Color of dialpad digits -->
+ <color name="dialpad_digits_text_color">#000000</color>
+ <!-- Color for dialpad separator lines -->
+ <color name="dialpad_separator_line_color">#dadada</color>
<!-- Color of the text describing an unconsumed missed call. -->
<color name="call_log_missed_call_highlight_color">#FF0000</color>
@@ -45,14 +57,6 @@
<!-- Background color of dialer list items (contacts, call log entries) -->
<color name="background_dialer_list_items">#eeeeee</color>
- <!-- Background color of new dialpad -->
- <color name="background_dialpad">#f2020709</color>
-
- <!-- Primary color of dialpad text, including the call button -->
- <color name="dialpad_primary_text_color">#33b5e5</color>
- <!-- Secondary color of dialpad text (used for the letters corresponding to each digit -->
- <color name="dialpad_secondary_text_color">#aaaaaa</color>
-
<!-- Background color of action bars. Ensure this stays in sync with packages/Telephony
actionbar_background_color. -->
<color name="actionbar_background_color">#3B77E7</color>
@@ -90,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 favorites menu when pressed. -->
- <color name="favorites_menu_pressed_color">#d6d6d6</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. -->
- <color name="favorites_menu_background_color">#ebebeb</color>
+ <color name="favorites_menu_background_color">#eeeeee</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 24ee2e0..6e563c1 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -16,18 +16,8 @@
-->
<resources>
- <!-- Height of edit text in dialpad fragment -->
- <dimen name="dialpad_horizontal_margin">0dip</dimen>
- <dimen name="dialpad_vertical_margin">2dip</dimen>
- <dimen name="dialpad_digits_text_size">35sp</dimen>
-
- <!-- Just used in landscape mode -->
- <dimen name="dialpad_digits_height">0px</dimen>
- <dimen name="dialpad_digits_margin_bottom">0px</dimen>
- <dimen name="dialpad_center_margin">3dp</dimen>
- <dimen name="dialpad_button_margin">2dp</dimen>
- <!-- Match call_button_height to Phone's dimens/in_call_end_button_height -->
- <dimen name="call_button_height">74dp</dimen>
+ <!-- Search View -->
+ <dimen name="search_text_size">14sp</dimen>
<!--
Drag to remove view (in dp because it is used in conjunction with a statically
@@ -54,20 +44,25 @@
the main area of a call log entry and the secondary action button. -->
<dimen name="call_log_list_item_vertical_divider_width">1dp</dimen>
- <!--
- Layout weight values for dialpad screen. These layouts will be used in one
- LinearLayout (dialpad_fragment.xml), configuring dialpad screen's vertical
- ratio.
- -->
- <integer name="dialpad_layout_weight_digits">15</integer>
- <integer name="dialpad_layout_weight_dialpad">65</integer>
-
<!-- Text dimensions for dialpad keys -->
- <dimen name="dialpad_key_numbers_size">40dp</dimen>
- <dimen name="dialpad_key_letters_size">11dp</dimen>
- <dimen name="dialpad_key_plus_size">15dp</dimen>
- <dimen name="dialpad_key_special_characters_size">25dp</dimen>
- <dimen name="dialpad_key_letters_width">41dp</dimen>
+ <dimen name="dialpad_key_numbers_size">40sp</dimen>
+ <dimen name="dialpad_key_letters_size">13sp</dimen>
+ <dimen name="dialpad_key_star_pound_size">26sp</dimen>
+ <dimen name="dialpad_key_numbers_width">30dp</dimen>
+ <dimen name="dialpad_key_letters_width">50dp</dimen>
+ <dimen name="dialpad_key_height">56dp</dimen>
+ <dimen name="dialpad_key_plus_size">18sp</dimen>
+ <dimen name="dialpad_number_to_letters_padding">11dp</dimen>
+ <dimen name="dialpad_horizontal_padding">5dp</dimen>
+ <dimen name="dialpad_digits_text_size">36sp</dimen>
+ <dimen name="dialpad_digits_height">47dp</dimen>
+ <dimen name="dialpad_digits_padding">16dp</dimen>
+ <dimen name="dialpad_digits_margin_bottom">0px</dimen>
+ <dimen name="dialpad_center_margin">3dp</dimen>
+ <dimen name="dialpad_button_margin">2dp</dimen>
+ <!-- Match call_button_height to Phone's dimens/in_call_end_button_height -->
+ <dimen name="call_button_height">74dp</dimen>
+
<dimen name="fake_action_bar_height">60dp</dimen>
<!-- Min with of fake menu buttons, which should be same as ActionBar's one -->
<dimen name="fake_menu_button_min_width">56dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ca97e6f..ce08ae5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -731,6 +731,7 @@
<!-- Remove button that shows up when contact is long-pressed. [CHAR LIMIT=NONE] -->
<string name="remove_contact">Remove</string>
+
<!-- Header text displayed on the main dialer screen above the list of favorite phone numbers.
[CHAR LIMIT=21] -->
<string name="favorites_menu_speed_dial">Speed Dial</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 6604658..207ab6b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -111,32 +111,46 @@
<item name="call_log_voicemail_status_action_text_color">#33b5e5</item>
</style>
- <style name="Theme">
+ <style name="DialpadKeyNumberStyle">
+ <item name="android:textColor">@color/actionbar_background_color</item>
+ <item name="android:textSize">@dimen/dialpad_key_numbers_size</item>
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:layout_width">@dimen/dialpad_key_numbers_width</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center</item>
</style>
- <style name="DialtactsDigitsTextAppearance">
- <item name="android:maxLines">1</item>
- <item name="android:scrollHorizontally">true</item>
- <item name="android:textSize">@dimen/dialpad_digits_text_size</item>
- <item name="android:freezesText">true</item>
- <item name="android:focusableInTouchMode">true</item>
- <item name="android:editable">true</item>
- <item name="android:cursorVisible">false</item>
- <item name="android:layout_weight">0</item>
+ <style name="DialpadKeyStarPoundStyle">
+ <item name="android:textColor">@color/dialpad_secondary_text_color</item>
+ <item name="android:textSize">@dimen/dialpad_key_star_pound_size</item>
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:layout_width">@dimen/dialpad_key_numbers_width</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center</item>
</style>
- <style name="DialtactsDialpadButtonStyle">
- <item name="android:layout_width">0dip</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_weight">1</item>
- <item name="android:background">?android:attr/selectableItemBackground</item>
+ <style name="DialpadKeyLettersStyle">
+ <item name="android:textColor">@color/dialpad_secondary_text_color</item>
+ <item name="android:textSize">@dimen/dialpad_key_letters_size</item>
+ <item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:layout_width">@dimen/dialpad_key_letters_width</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:paddingLeft">@dimen/dialpad_number_to_letters_padding</item>
+ </style>
+
+ <style name="DialpadKeyButtonStyle">
<item name="android:soundEffectsEnabled">false</item>
+ <item name="android:clickable">true</item>
+ <item name="android:layout_width">fill_parent</item>
+ <item name="android:layout_height">@dimen/dialpad_key_height</item>
+ <item name="android:background">@drawable/dialpad_key_colors</item>
+ <item name="android:focusable">true</item>
</style>
- <style name="DialpadHorizontalSeparator">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">@dimen/dialpad_vertical_margin</item>
- <item name="android:background">#66000000</item>
+ <style name="DialpadKeyInternalLayoutStyle">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_gravity">center</item>
</style>
<style name="DialtactsActionBarStyle" parent="android:Widget.Holo.ActionBar">
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 2b6566f..e09e6f3 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -32,6 +32,7 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.CallLog;
+import android.provider.ContactsContract;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
@@ -56,6 +57,7 @@
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.ClipboardUtils;
+import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.model.Contact;
import com.android.contacts.common.model.ContactLoader;
@@ -545,14 +547,14 @@
mainActionDescription);
}
+ final CharSequence displayNumber =
+ mPhoneNumberHelper.getDisplayNumber(
+ firstDetails.number,
+ firstDetails.numberPresentation,
+ firstDetails.formattedNumber);
+
// This action allows to call the number that places the call.
if (canPlaceCallsTo) {
- final CharSequence displayNumber =
- mPhoneNumberHelper.getDisplayNumber(
- firstDetails.number,
- firstDetails.numberPresentation,
- firstDetails.formattedNumber);
-
ViewEntry entry = new ViewEntry(
getString(R.string.menu_callNumber,
forceLeftToRight(displayNumber)),
@@ -623,7 +625,20 @@
}
},
historyList);
- loadContactPhotos(photoUri);
+
+ final String displayNameForDefaultImage = TextUtils.isEmpty(firstDetails.name) ?
+ displayNumber.toString() : firstDetails.name.toString();
+
+ final String lookupKey = ContactInfoHelper.getLookupKeyFromUri(contactUri);
+
+ final boolean isBusiness = mContactInfoHelper.isBusiness(firstDetails.sourceType);
+
+ final int contactType =
+ isVoicemailNumber? ContactPhotoManager.TYPE_VOICEMAIL :
+ isBusiness ? ContactPhotoManager.TYPE_BUSINESS :
+ ContactPhotoManager.TYPE_DEFAULT;
+
+ loadContactPhotos(photoUri, displayNameForDefaultImage, lookupKey, contactType);
findViewById(R.id.call_detail).setVisibility(View.VISIBLE);
}
}
@@ -690,6 +705,7 @@
final CharSequence numberLabel;
final Uri photoUri;
final Uri lookupUri;
+ int sourceType;
// If this is not a regular number, there is no point in looking it up in the contacts.
ContactInfo info =
PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
@@ -704,6 +720,7 @@
numberLabel = "";
photoUri = null;
lookupUri = null;
+ sourceType = 0;
} else {
formattedNumber = info.formattedNumber;
nameText = info.name;
@@ -711,11 +728,12 @@
numberLabel = info.label;
photoUri = info.photoUri;
lookupUri = info.lookupUri;
+ sourceType = info.sourceType;
}
return new PhoneCallDetails(number, numberPresentation,
formattedNumber, countryIso, geocode,
new int[]{ callType }, date, duration,
- nameText, numberType, numberLabel, lookupUri, photoUri);
+ nameText, numberType, numberLabel, lookupUri, photoUri, sourceType);
} finally {
if (callCursor != null) {
callCursor.close();
@@ -724,9 +742,12 @@
}
/** Load the contact photos and places them in the corresponding views. */
- private void loadContactPhotos(Uri photoUri) {
+ private void loadContactPhotos(Uri photoUri, String displayName, String lookupKey,
+ int contactType) {
+ final DefaultImageRequest request = new DefaultImageRequest(displayName, lookupKey,
+ contactType);
mContactPhotoManager.loadPhoto(mContactBackgroundView, photoUri,
- mContactBackgroundView.getWidth(), true);
+ mContactBackgroundView.getWidth(), true, request);
}
static final class ViewEntry {
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 5989e52..eee3838 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -28,7 +28,6 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
@@ -40,18 +39,18 @@
import android.speech.RecognizerIntent;
import android.telephony.TelephonyManager;
import android.text.Editable;
-import android.text.Spannable;
-import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
-import android.text.style.ImageSpan;
import android.util.Log;
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;
@@ -88,13 +87,13 @@
public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener,
DialpadFragment.OnDialpadQueryChangedListener, PopupMenu.OnMenuItemClickListener,
OnListFragmentScrolledListener,
- DialpadFragment.OnDialpadFragmentStartedListener,
+ DialpadFragment.HostInterface,
PhoneFavoriteFragment.OnShowAllContactsListener,
PhoneFavoriteFragment.HostInterface,
- OnDragDropListener {
+ OnDragDropListener, View.OnLongClickListener {
private static final String TAG = "DialtactsActivity";
- public static final boolean DEBUG = false;
+ public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
public static final String SHARED_PREFS_NAME = "com.android.dialer_preferences";
@@ -121,8 +120,6 @@
*/
private static final String ACTION_TOUCH_DIALER = "com.android.phone.action.TOUCH_DIALER";
- private static final int SUBACTIVITY_ACCOUNT_FILTER = 1;
-
private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1;
private static final int FADE_ANIMATION_DURATION = 200;
@@ -150,14 +147,16 @@
private SmartDialSearchFragment mSmartDialSearchFragment;
private View mMenuButton;
+ private View mFakeActionBar;
private View mCallHistoryButton;
private View mDialpadButton;
+ private View mDialButton;
private PopupMenu mOverflowMenu;
- // Padding view used to shift the fragments up when the dialpad is shown.
- private View mBottomPaddingView;
+ // Padding view used to shift the fragment frame up when the dialpad is shown so that
+ // the contents of the fragment frame continue to exist in a layout of the same height
+ private View mFragmentsSpacer;
private View mFragmentsFrame;
- private View mActionBar;
private boolean mInDialpadSearch;
private boolean mInRegularSearch;
@@ -174,6 +173,9 @@
private boolean mFirstLaunch;
private View mSearchViewContainer;
private RemoveView mRemoveViewContainer;
+ // This view points to the Framelayout that houses both the search view and remove view
+ // containers.
+ private View mSearchAndRemoveViewContainer;
private View mSearchViewCloseButton;
private View mVoiceSearchButton;
private EditText mSearchView;
@@ -302,12 +304,10 @@
// Add the favorites fragment, and the dialpad fragment, but only if savedInstanceState
// is null. Otherwise the fragment manager takes care of recreating these fragments.
if (savedInstanceState == null) {
- final PhoneFavoriteFragment phoneFavoriteFragment = new PhoneFavoriteFragment();
-
- final FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.add(R.id.dialtacts_frame, phoneFavoriteFragment, TAG_FAVORITES_FRAGMENT);
- ft.add(R.id.dialtacts_container, new DialpadFragment(), TAG_DIALPAD_FRAGMENT);
- ft.commit();
+ getFragmentManager().beginTransaction()
+ .add(R.id.dialtacts_frame, new PhoneFavoriteFragment(), TAG_FAVORITES_FRAGMENT)
+ .add(R.id.dialtacts_container, new DialpadFragment(), TAG_DIALPAD_FRAGMENT)
+ .commit();
} else {
mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
mInRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI);
@@ -315,10 +315,27 @@
mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH);
}
- mBottomPaddingView = findViewById(R.id.dialtacts_bottom_padding);
mFragmentsFrame = findViewById(R.id.dialtacts_frame);
- mActionBar = findViewById(R.id.fake_action_bar);
+ mFragmentsSpacer = findViewById(R.id.contact_tile_frame_spacer);
+
mRemoveViewContainer = (RemoveView) findViewById(R.id.remove_view_container);
+ mSearchAndRemoveViewContainer = findViewById(R.id.search_and_remove_view_container);
+
+ // When the first global layout pass is completed (and mSearchAndRemoveViewContainer has
+ // been assigned a valid height), assign that height to mFragmentsSpacer as well.
+ mSearchAndRemoveViewContainer.getViewTreeObserver().addOnGlobalLayoutListener(
+ new OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ mSearchAndRemoveViewContainer.getViewTreeObserver()
+ .removeOnGlobalLayoutListener(this);
+ mFragmentsSpacer.setLayoutParams(
+ new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+ mSearchAndRemoveViewContainer.getHeight()));
+ }
+ });
+
+
prepareSearchView();
if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())
@@ -326,6 +343,7 @@
setupFilterText(intent);
}
+ hideDialpadFragment(false, false);
setupFakeActionBarItems();
mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this);
@@ -432,7 +450,11 @@
public void onClick(View view) {
switch (view.getId()) {
case R.id.overflow_menu: {
- mOverflowMenu.show();
+ if (isDialpadShowing()) {
+ mDialpadFragment.optionsMenuInvoked(view);
+ } else {
+ mOverflowMenu.show();
+ }
break;
}
case R.id.dialpad_button:
@@ -443,7 +465,10 @@
mInCallDialpadUp = false;
showDialpadFragment(true);
break;
- case R.id.call_history_on_dialpad_button:
+ case R.id.dial_button:
+ // Dial button was pressed; tell the Dialpad fragment
+ mDialpadFragment.dialButtonPressed();
+ break;
case R.id.call_history_button:
// Use explicit CallLogActivity intent instead of ACTION_VIEW +
// CONTENT_TYPE, so that we always open our call log from our dialer
@@ -474,6 +499,22 @@
}
@Override
+ public boolean onLongClick(View view) {
+ switch (view.getId()) {
+ case R.id.dial_button: {
+ // Dial button was pressed; tell the Dialpad fragment
+ mDialpadFragment.dialButtonPressed();
+ return true; // Consume the event
+ }
+ default: {
+ Log.wtf(TAG, "Unexpected onClick event from " + view);
+ break;
+ }
+ }
+ return false;
+ }
+
+ @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ACTIVITY_REQUEST_CODE_VOICE_SEARCH) {
if (resultCode == RESULT_OK) {
@@ -502,6 +543,8 @@
}
ft.show(mDialpadFragment);
ft.commit();
+ mDialButton.setVisibility(shouldShowOnscreenDialButton() ? View.VISIBLE : View.GONE);
+ mDialpadButton.setVisibility(View.GONE);
}
public void hideDialpadFragment(boolean animate, boolean clearDialpad) {
@@ -517,6 +560,8 @@
}
ft.hide(mDialpadFragment);
ft.commit();
+ mDialButton.setVisibility(View.GONE);
+ mDialpadButton.setVisibility(View.VISIBLE);
}
private void prepareSearchView() {
@@ -545,7 +590,7 @@
final AnimatorListener mHideListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- mSearchViewContainer.setVisibility(View.GONE);
+ mSearchAndRemoveViewContainer.setVisibility(View.GONE);
}
};
@@ -564,53 +609,51 @@
}
public void hideSearchBar() {
- hideSearchBar(true);
- }
+ final int height = mSearchAndRemoveViewContainer.getHeight();
- public void hideSearchBar(boolean shiftView) {
- if (shiftView) {
- mSearchViewContainer.animate().cancel();
- mSearchViewContainer.setAlpha(1);
- mSearchViewContainer.setTranslationY(0);
- mSearchViewContainer.animate().withLayer().alpha(0).translationY(-mSearchView.getHeight())
- .setDuration(200).setListener(mHideListener);
+ mSearchAndRemoveViewContainer.animate().cancel();
+ mSearchAndRemoveViewContainer.setAlpha(1);
+ mSearchAndRemoveViewContainer.setTranslationY(0);
+ mSearchAndRemoveViewContainer.animate().withLayer().alpha(0)
+ .translationY(-height).setDuration(200)
+ .setListener(mHideListener);
- mFragmentsFrame.animate().withLayer()
- .translationY(-mSearchViewContainer.getHeight()).setDuration(200).setListener(
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mBottomPaddingView.setVisibility(View.VISIBLE);
- mFragmentsFrame.setTranslationY(0);
- mActionBar.setVisibility(View.INVISIBLE);
- }
- });
- } else {
- mSearchViewContainer.setTranslationY(-mSearchView.getHeight());
- mActionBar.setVisibility(View.INVISIBLE);
- }
+ mFragmentsFrame.animate().withLayer()
+ .translationY(-height).setDuration(200).setListener(
+ new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mFragmentsFrame.setTranslationY(0);
+ // Display the fragments spacer (which has the same height as the
+ // search box) now that the search box is hidden, so that
+ // mFragmentsFrame always retains the same height
+ mFragmentsSpacer.setVisibility(View.VISIBLE);
+ }
+ });
}
public void showSearchBar() {
- 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) {
- mSearchViewContainer.setVisibility(View.VISIBLE);
- mActionBar.setVisibility(View.VISIBLE);
- }
- });
+ final int height = mSearchAndRemoveViewContainer.getHeight();
+ mSearchAndRemoveViewContainer.animate().cancel();
+ mSearchAndRemoveViewContainer.setAlpha(0);
+ mSearchAndRemoveViewContainer.setTranslationY(-height);
+ mSearchAndRemoveViewContainer.animate().withLayer().alpha(1).translationY(0)
+ .setDuration(200).setListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ mSearchAndRemoveViewContainer.setVisibility(View.VISIBLE);
+ }
+ });
- mFragmentsFrame.setTranslationY(-mSearchViewContainer.getHeight());
+ mFragmentsFrame.setTranslationY(-height);
mFragmentsFrame.animate().withLayer().translationY(0).setDuration(200)
.setListener(
new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
- mBottomPaddingView.setVisibility(View.GONE);
+ // Hide the fragment spacer now that the search box will
+ // be displayed again
+ mFragmentsSpacer.setVisibility(View.GONE);
}
});
}
@@ -628,20 +671,21 @@
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);
+ mDialButton.setOnClickListener(this);
+ mDialButton.setOnLongClickListener(this);
+
mDialpadButton = findViewById(R.id.dialpad_button);
// DialpadButton.setMinimumWidth(fakeMenuItemWidth);
mDialpadButton.setOnClickListener(this);
}
- public void setupFakeActionBarItemsForDialpadFragment() {
- final View callhistoryButton = findViewById(R.id.call_history_on_dialpad_button);
- callhistoryButton.setOnClickListener(this);
- }
-
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
@@ -937,8 +981,13 @@
}
@Override
- public void onDialpadFragmentStarted() {
- setupFakeActionBarItemsForDialpadFragment();
+ public void setDialButtonEnabled(boolean enabled) {
+ mDialButton.setEnabled(enabled);
+ }
+
+ @Override
+ public void setDialButtonContainerVisible(boolean visible) {
+ mFakeActionBar.setVisibility(visible ? View.VISIBLE : View.GONE);
}
private boolean phoneIsInUse() {
@@ -960,12 +1009,6 @@
return intent;
}
- public static Intent getInsertContactWithNameIntent(CharSequence text) {
- final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
- intent.putExtra(Intents.Insert.NAME, text);
- return intent;
- }
-
private boolean canIntentBeHandled(Intent intent) {
final PackageManager packageManager = getPackageManager();
final List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent,
@@ -1016,4 +1059,8 @@
fadeIn.animate().alpha(1).setDuration(FADE_ANIMATION_DURATION)
.setListener(null);
}
+
+ private boolean shouldShowOnscreenDialButton() {
+ return getResources().getBoolean(R.bool.config_show_onscreen_dial_button);
+ }
}
diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java
index c380b65..4e01ab5 100644
--- a/src/com/android/dialer/PhoneCallDetails.java
+++ b/src/com/android/dialer/PhoneCallDetails.java
@@ -59,13 +59,17 @@
* This is meant to store the high-res photo only.
*/
public final Uri photoUri;
+ /**
+ * The source type of the contact associated with this call.
+ */
+ public final int sourceType;
/** Create the details for a call with a number not associated with a contact. */
public PhoneCallDetails(CharSequence number, int numberPresentation,
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration) {
this(number, numberPresentation, formattedNumber, countryIso, geocode,
- callTypes, date, duration, "", 0, "", null, null);
+ callTypes, date, duration, "", 0, "", null, null, 0);
}
/** Create the details for a call with a number associated with a contact. */
@@ -73,7 +77,7 @@
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration, CharSequence name,
int numberType, CharSequence numberLabel, Uri contactUri,
- Uri photoUri) {
+ Uri photoUri, int sourceType) {
this.number = number;
this.numberPresentation = numberPresentation;
this.formattedNumber = formattedNumber;
@@ -87,5 +91,6 @@
this.numberLabel = numberLabel;
this.contactUri = contactUri;
this.photoUri = photoUri;
+ this.sourceType = sourceType;
}
}
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 32699e6..aee24ba 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -27,6 +27,7 @@
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
import android.text.TextUtils;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -37,11 +38,13 @@
import com.android.common.widget.GroupingListAdapter;
import com.android.contacts.common.ContactPhotoManager;
+import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.util.UriUtils;
import com.android.dialer.PhoneCallDetails;
import com.android.dialer.PhoneCallDetailsHelper;
import com.android.dialer.R;
import com.android.dialer.util.ExpirableCache;
+
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
@@ -537,6 +540,9 @@
final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c);
+ final boolean isVoicemailNumber =
+ PhoneNumberUtilsWrapper.INSTANCE.isVoicemailNumber(number);
+
// Primary action is always to call, if possible.
if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
// Sets the primary action to call the number.
@@ -569,7 +575,7 @@
mContactInfoCache.getCachedValue(numberCountryIso);
ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue();
if (!PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
- || new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) {
+ || isVoicemailNumber) {
// If this is a number that cannot be dialed, there is no point in looking up a contact
// for it.
info = ContactInfo.EMPTY;
@@ -609,6 +615,7 @@
CharSequence formattedNumber = info.formattedNumber;
final int[] callTypes = getCallTypes(c, count);
final String geocode = c.getString(CallLogQuery.GEOCODED_LOCATION);
+ final int sourceType = info.sourceType;
final PhoneCallDetails details;
if (TextUtils.isEmpty(name)) {
@@ -618,7 +625,7 @@
} else {
details = new PhoneCallDetails(number, numberPresentation,
formattedNumber, countryIso, geocode, callTypes, date,
- duration, name, ntype, label, lookupUri, photoUri);
+ duration, name, ntype, label, lookupUri, photoUri, sourceType);
}
final boolean isNew = c.getInt(CallLogQuery.IS_READ) == 0;
@@ -627,10 +634,29 @@
mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted,
mShowSecondaryActionButton);
- if (photoId == 0 && photoUri != null) {
- setPhoto(views, photoUri, lookupUri);
+ int contactType = ContactPhotoManager.TYPE_DEFAULT;
+
+ if (isVoicemailNumber) {
+ contactType = ContactPhotoManager.TYPE_VOICEMAIL;
+ } else if (mContactInfoHelper.isBusiness(info.sourceType)) {
+ contactType = ContactPhotoManager.TYPE_BUSINESS;
+ }
+
+ String lookupKey = lookupUri == null ? null
+ : ContactInfoHelper.getLookupKeyFromUri(lookupUri);
+
+ String nameForDefaultImage = null;
+ if (TextUtils.isEmpty(name)) {
+ nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(details.number,
+ details.numberPresentation, details.formattedNumber).toString();
} else {
- setPhoto(views, photoId, lookupUri);
+ nameForDefaultImage = name;
+ }
+
+ if (photoId == 0 && photoUri != null) {
+ setPhoto(views, photoUri, lookupUri, nameForDefaultImage, lookupKey, contactType);
+ } else {
+ setPhoto(views, photoId, lookupUri, nameForDefaultImage, lookupKey, contactType);
}
// Listen for the first draw
@@ -853,15 +879,22 @@
return callTypes;
}
- private void setPhoto(CallLogListItemViews views, long photoId, Uri contactUri) {
+ private void setPhoto(CallLogListItemViews views, long photoId, Uri contactUri,
+ String displayName, String identifier, int contactType) {
views.quickContactView.assignContactUri(contactUri);
- mContactPhotoManager.loadThumbnail(views.quickContactView, photoId, false /* darkTheme */);
+ DefaultImageRequest request = new DefaultImageRequest(displayName, identifier,
+ contactType);
+ mContactPhotoManager.loadThumbnail(views.quickContactView, photoId, false /* darkTheme */,
+ request);
}
- private void setPhoto(CallLogListItemViews views, Uri photoUri, Uri contactUri) {
+ private void setPhoto(CallLogListItemViews views, Uri photoUri, Uri contactUri,
+ String displayName, String identifier, int contactType) {
views.quickContactView.assignContactUri(contactUri);
+ DefaultImageRequest request = new DefaultImageRequest(displayName, identifier,
+ contactType);
mContactPhotoManager.loadDirectoryPhoto(views.quickContactView, photoUri,
- false /* darkTheme */);
+ false /* darkTheme */, request);
}
diff --git a/src/com/android/dialer/calllog/ContactInfo.java b/src/com/android/dialer/calllog/ContactInfo.java
index 601f552..41afa5a 100644
--- a/src/com/android/dialer/calllog/ContactInfo.java
+++ b/src/com/android/dialer/calllog/ContactInfo.java
@@ -27,6 +27,7 @@
*/
public class ContactInfo {
public Uri lookupUri;
+ public String lookupKey;
public String name;
public int type;
public String label;
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index d248c70..84ce27e 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -1,17 +1,15 @@
/*
* Copyright (C) 2011 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
+ * 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
+ * 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.
+ * 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.
*/
package com.android.dialer.calllog;
@@ -37,6 +35,8 @@
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.List;
+
/**
* Utility class to look up the contact information for a given number.
*/
@@ -101,7 +101,7 @@
updatedInfo = new ContactInfo();
updatedInfo.number = number;
updatedInfo.formattedNumber = formatPhoneNumber(number, null, countryIso);
- updatedInfo.lookupUri = createTemporaryContactUri(number);
+ updatedInfo.lookupUri = createTemporaryContactUri(updatedInfo.formattedNumber);
} else {
updatedInfo = info;
}
@@ -113,23 +113,20 @@
* Creates a JSON-encoded lookup uri for a unknown number without an associated contact
*
* @param number - Unknown phone number
- * @return JSON-encoded URI that can be used to perform a lookup when clicking
- * on the quick contact card.
+ * @return JSON-encoded URI that can be used to perform a lookup when clicking on the quick
+ * contact card.
*/
private static Uri createTemporaryContactUri(String number) {
try {
- final JSONObject contactRows = new JSONObject()
- .put(Phone.CONTENT_ITEM_TYPE, new JSONObject()
- .put(Phone.NUMBER, number)
- .put(Phone.TYPE, Phone.TYPE_CUSTOM));
+ final JSONObject contactRows = new JSONObject().put(Phone.CONTENT_ITEM_TYPE,
+ new JSONObject().put(Phone.NUMBER, number).put(Phone.TYPE, Phone.TYPE_CUSTOM));
- final String jsonString = new JSONObject()
- .put(Contacts.DISPLAY_NAME, number)
- .put(Contacts.DISPLAY_NAME_SOURCE, DisplayNameSources.PHONE)
- .put(Contacts.CONTENT_ITEM_TYPE, contactRows)
- .toString();
+ final String jsonString = new JSONObject().put(Contacts.DISPLAY_NAME, number)
+ .put(Contacts.DISPLAY_NAME_SOURCE, DisplayNameSources.PHONE)
+ .put(Contacts.CONTENT_ITEM_TYPE, contactRows).toString();
- return Contacts.CONTENT_LOOKUP_URI.buildUpon()
+ return Contacts.CONTENT_LOOKUP_URI
+ .buildUpon()
.appendPath(Constants.LOOKUP_URI_ENCODED)
.appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY,
String.valueOf(Long.MAX_VALUE))
@@ -152,8 +149,7 @@
private ContactInfo lookupContactFromUri(Uri uri) {
final ContactInfo info;
Cursor phonesCursor =
- mContext.getContentResolver().query(
- uri, PhoneQuery._PROJECTION, null, null, null);
+ mContext.getContentResolver().query(uri, PhoneQuery._PROJECTION, null, null, null);
if (phonesCursor != null) {
try {
@@ -161,6 +157,7 @@
info = new ContactInfo();
long contactId = phonesCursor.getLong(PhoneQuery.PERSON_ID);
String lookupKey = phonesCursor.getString(PhoneQuery.LOOKUP_KEY);
+ info.lookupKey = lookupKey;
info.lookupUri = Contacts.getLookupUri(contactId, lookupKey);
info.name = phonesCursor.getString(PhoneQuery.NAME);
info.type = phonesCursor.getInt(PhoneQuery.PHONE_TYPE);
@@ -230,8 +227,8 @@
if (info != null && info != ContactInfo.EMPTY) {
info.formattedNumber = formatPhoneNumber(number, null, countryIso);
} else if (mCachedNumberLookupService != null) {
- CachedContactInfo cacheInfo = mCachedNumberLookupService
- .lookupCachedContactFromNumber(mContext, number);
+ CachedContactInfo cacheInfo =
+ mCachedNumberLookupService.lookupCachedContactFromNumber(mContext, number);
info = cacheInfo != null ? cacheInfo.getContactInfo() : null;
}
return info;
@@ -242,14 +239,12 @@
*
* @param number the number to be formatted.
* @param normalizedNumber the normalized number of the given number.
- * @param countryIso the ISO 3166-1 two letters country code, the country's
- * convention will be used to format the number if the normalized
- * phone is null.
+ * @param countryIso the ISO 3166-1 two letters country code, the country's convention will be
+ * used to format the number if the normalized phone is null.
*
* @return the formatted number, or the given number if it was formatted.
*/
- private String formatPhoneNumber(String number, String normalizedNumber,
- String countryIso) {
+ private String formatPhoneNumber(String number, String normalizedNumber, String countryIso) {
if (TextUtils.isEmpty(number)) {
return "";
}
@@ -262,4 +257,32 @@
}
return PhoneNumberUtils.formatNumber(number, normalizedNumber, countryIso);
}
+
+ /**
+ * Parses the given URI to determine the original lookup key of the contact.
+ */
+ public static String getLookupKeyFromUri(Uri lookupUri) {
+ // Would be nice to be able to persist the lookup key somehow to avoid having to parse
+ // the uri entirely just to retrieve the lookup key, but every uri is already parsed
+ // once anyway to check if it is an encoded JSON uri, so this has negligible effect
+ // on performance.
+ if (lookupUri != null && !UriUtils.isEncodedContactUri(lookupUri)) {
+ final List<String> segments = lookupUri.getPathSegments();
+ // This returns the third path segment of the uri, where the lookup key is located.
+ // See {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}.
+ return (segments.size() < 3) ? null : segments.get(2);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Given a contact's sourceType, return true if the contact is a business
+ *
+ * @param sourceType sourceType of the contact. This is usually populated by
+ * {@link #mCachedNumberLookupService}.
+ */
+ public boolean isBusiness(int sourceType) {
+ return mCachedNumberLookupService.isBusiness(sourceType);
+ }
}
diff --git a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
index 9c83768..00a260a 100644
--- a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
@@ -30,7 +30,7 @@
*
*/
public class PhoneNumberUtilsWrapper {
- private static final PhoneNumberUtilsWrapper INSTANCE = new PhoneNumberUtilsWrapper();
+ public static final PhoneNumberUtilsWrapper INSTANCE = new PhoneNumberUtilsWrapper();
private static final Set<String> LEGACY_UNKNOWN_NUMBERS = Sets.newHashSet("-1", "-2", "-3");
/** Returns true if it is possible to place a call to the given number. */
diff --git a/src/com/android/dialer/database/DialerDatabaseHelper.java b/src/com/android/dialer/database/DialerDatabaseHelper.java
index 5bfe11a..95249a6 100644
--- a/src/com/android/dialer/database/DialerDatabaseHelper.java
+++ b/src/com/android/dialer/database/DialerDatabaseHelper.java
@@ -163,6 +163,17 @@
/** Selects only rows that have been updated after a certain time stamp.*/
static final String SELECT_UPDATED_CLAUSE =
Phone.CONTACT_LAST_UPDATED_TIMESTAMP + " > ?";
+
+ /** Ignores contacts that have an unreasonably long lookup key. These are likely to be
+ * the result of multiple (> 50) merged raw contacts, and are likely to cause
+ * OutOfMemoryExceptions within SQLite, or cause memory allocation problems later on
+ * when iterating through the cursor set (see b/13133579)
+ */
+ static final String SELECT_IGNORE_LOOKUP_KEY_TOO_LONG_CLAUSE =
+ "length(" + Phone.LOOKUP_KEY + ") < 1000";
+
+ static final String SELECTION = SELECT_UPDATED_CLAUSE + " AND " +
+ SELECT_IGNORE_LOOKUP_KEY_TOO_LONG_CLAUSE;
}
/** Query options for querying the deleted contact database.*/
@@ -658,7 +669,6 @@
} else {
insert.bindString(5, displayName);
}
-
insert.bindLong(1, updatedContactCursor.getLong(PhoneQuery.PHONE_ID));
insert.bindLong(3, updatedContactCursor.getLong(PhoneQuery.PHONE_CONTACT_ID));
insert.bindLong(6, updatedContactCursor.getLong(PhoneQuery.PHONE_PHOTO_ID));
@@ -758,7 +768,7 @@
* update time.
*/
final Cursor updatedContactCursor = mContext.getContentResolver().query(PhoneQuery.URI,
- PhoneQuery.PROJECTION, PhoneQuery.SELECT_UPDATED_CLAUSE,
+ PhoneQuery.PROJECTION, PhoneQuery.SELECTION,
new String[]{lastUpdateMillis}, null);
/** Sets the time after querying the database as the current update time. */
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 0d23378..ae9700f 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -35,11 +35,9 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.provider.ContactsContract.Contacts;
import android.provider.Contacts.People;
import android.provider.Contacts.Phones;
import android.provider.Contacts.PhonesColumns;
-import android.provider.ContactsContract.Intents;
import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneStateListener;
@@ -50,17 +48,13 @@
import android.text.TextWatcher;
import android.text.style.RelativeSizeSpan;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
import android.util.Log;
-import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
-import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnPreDrawListener;
@@ -76,17 +70,12 @@
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.GeoUtil;
-import com.android.contacts.common.activity.TransactionSafeActivity;
-import com.android.contacts.common.preference.ContactsPreferences;
import com.android.contacts.common.util.PhoneNumberFormatter;
import com.android.contacts.common.util.StopWatch;
import com.android.dialer.NeededForReflection;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
import com.android.dialer.SpecialCharSequenceMgr;
-import com.android.dialer.database.DialerDatabaseHelper;
-import com.android.dialer.interactions.PhoneNumberInteraction;
-import com.android.dialer.util.OrientationUtil;
import com.android.internal.telephony.ITelephony;
import com.android.phone.common.CallLogAsync;
import com.android.phone.common.HapticFeedback;
@@ -105,8 +94,19 @@
DialpadKeyButton.OnPressedListener {
private static final String TAG = DialpadFragment.class.getSimpleName();
- public interface OnDialpadFragmentStartedListener {
- public void onDialpadFragmentStarted();
+ /**
+ * This interface allows the DialpadFragment to tell its hosting Activity when and when not
+ * to display the "dial" button. While this is logically part of the DialpadFragment, the
+ * need to have a particular kind of slick animation puts the "dial" button in the parent.
+ *
+ * The parent calls dialButtonPressed() and optionsMenuInvoked() on the dialpad fragment
+ * when appropriate.
+ *
+ * TODO: Refactor the app so this interchange is a bit cleaner.
+ */
+ public interface HostInterface {
+ void setDialButtonEnabled(boolean enabled);
+ void setDialButtonContainerVisible(boolean visible);
}
/**
@@ -210,8 +210,6 @@
*/
private final HashSet<View> mPressedDialpadKeys = new HashSet<View>(12);
- private View mDialButtonContainer;
- private View mDialButton;
private ListView mDialpadChooser;
private DialpadChooserAdapter mDialpadChooserAdapter;
@@ -396,7 +394,6 @@
// Load up the resources for the text field.
Resources r = getResources();
- mDialButtonContainer = fragmentView.findViewById(R.id.dialButtonContainer);
mDigitsContainer = fragmentView.findViewById(R.id.digits_container);
mDigits = (EditText) fragmentView.findViewById(R.id.digits);
mDigits.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
@@ -411,15 +408,6 @@
setupKeypad(fragmentView);
}
- mDialButton = fragmentView.findViewById(R.id.dialButton);
- if (r.getBoolean(R.bool.config_show_onscreen_dial_button)) {
- mDialButton.setOnClickListener(this);
- mDialButton.setOnLongClickListener(this);
- } else {
- mDialButton.setVisibility(View.GONE); // It's VISIBLE by default
- mDialButton = null;
- }
-
mDelete = fragmentView.findViewById(R.id.deleteButton);
if (mDelete != null) {
mDelete.setOnClickListener(this);
@@ -457,18 +445,6 @@
@Override
public void onStart() {
super.onStart();
-
- final Activity activity = getActivity();
-
- try {
- ((OnDialpadFragmentStartedListener) activity).onDialpadFragmentStarted();
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnDialpadFragmentStartedListener");
- }
-
- final View overflowButton = getView().findViewById(R.id.overflow_menu_on_dialpad);
- overflowButton.setOnClickListener(this);
}
private boolean isLayoutReady() {
@@ -654,10 +630,6 @@
dialpadKey.setContentDescription(numberString);
if (lettersView != null) {
lettersView.setText(resources.getString(letterIds[i]));
- if (buttonIds[i] == R.id.zero) {
- lettersView.setTextSize(TypedValue.COMPLEX_UNIT_PX, resources.getDimension(
- R.dimen.dialpad_key_plus_size));
- }
}
}
@@ -881,7 +853,7 @@
switch (view.getId()) {
case R.id.digits:
if (keyCode == KeyEvent.KEYCODE_ENTER) {
- dialButtonPressed();
+ handleDialButtonPressed();
return true;
}
break;
@@ -963,27 +935,37 @@
}
}
+ /**
+ * Called by the containing Activity to tell this Fragment that the gesture to display the
+ * "options" menu has been invoked.
+ *
+ * @param invoker the View that invoked the options menu, to act as an anchor location.
+ */
+ public void optionsMenuInvoked(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();
+ }
+
+ /**
+ * Called by the containing Activity to tell this Fragment that the dial button has been
+ * pressed.
+ */
+ public void dialButtonPressed() {
+ mHaptic.vibrate();
+ handleDialButtonPressed();
+ }
+
@Override
public void onClick(View view) {
switch (view.getId()) {
- case R.id.overflow_menu_on_dialpad: {
- final PopupMenu popupMenu = new PopupMenu(getActivity(), view);
- final Menu menu = popupMenu.getMenu();
- popupMenu.inflate(R.menu.dialpad_options);
- popupMenu.setOnMenuItemClickListener(this);
- setupMenuItems(menu);
- popupMenu.show();
- break;
- }
case R.id.deleteButton: {
keyPressed(KeyEvent.KEYCODE_DEL);
return;
}
- case R.id.dialButton: {
- mHaptic.vibrate(); // Vibrate here too, just like we do for the regular keys
- dialButtonPressed();
- return;
- }
case R.id.digits: {
if (!isDigitsEmpty()) {
mDigits.setCursorVisible(true);
@@ -1058,16 +1040,6 @@
mDigits.setCursorVisible(true);
return false;
}
- case R.id.dialButton: {
- if (isDigitsEmpty()) {
- handleDialButtonClickWithEmptyDigits();
- // This event should be consumed so that onClick() won't do the exactly same
- // thing.
- return true;
- } else {
- return false;
- }
- }
}
return false;
}
@@ -1160,7 +1132,7 @@
* user needs to press the dial button again, to dial it (general
* case described above).
*/
- public void dialButtonPressed() {
+ private void handleDialButtonPressed() {
if (isDigitsEmpty()) { // No number entered.
handleDialButtonClickWithEmptyDigits();
} else {
@@ -1330,7 +1302,7 @@
mDigits.setVisibility(View.GONE);
}
if (mDialpad != null) mDialpad.setVisibility(View.GONE);
- if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.GONE);
+ ((HostInterface) getActivity()).setDialButtonContainerVisible(false);
mDialpadChooser.setVisibility(View.VISIBLE);
@@ -1348,7 +1320,7 @@
mDigits.setVisibility(View.VISIBLE);
}
if (mDialpad != null) mDialpad.setVisibility(View.VISIBLE);
- if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.VISIBLE);
+ ((HostInterface) getActivity()).setDialButtonContainerVisible(true);
mDialpadChooser.setVisibility(View.GONE);
}
}
@@ -1597,23 +1569,18 @@
*/
private void updateDialAndDeleteButtonEnabledState() {
final boolean digitsNotEmpty = !isDigitsEmpty();
-
- if (mDialButton != null) {
- // On CDMA phones, if we're already on a call, we *always*
- // enable the Dial button (since you can press it without
- // entering any digits to send an empty flash.)
- if (phoneIsCdma() && phoneIsOffhook()) {
- mDialButton.setEnabled(true);
- } else {
- // Common case: GSM, or CDMA but not on a call.
- // Enable the Dial button if some digits have
- // been entered, or if there is a last dialed number
- // that could be redialed.
- mDialButton.setEnabled(digitsNotEmpty ||
- !TextUtils.isEmpty(mLastNumberDialed));
- }
- }
mDelete.setEnabled(digitsNotEmpty);
+ // On CDMA phones, if we're already on a call, we *always* enable the Dial button (since
+ // you can press it without entering any digits to send an empty flash.)
+ if (phoneIsCdma() && phoneIsOffhook()) {
+ ((HostInterface) getActivity()).setDialButtonEnabled(true);
+ } else {
+ // Common case: GSM, or CDMA but not on a call. Enable the Dial button if something
+ // has been entered into the digits field, or if there is a last dialed number that
+ // could be redialed.
+ ((HostInterface) getActivity()).setDialButtonEnabled(
+ digitsNotEmpty || !TextUtils.isEmpty(mLastNumberDialed));
+ }
}
/**
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 79dbe8c..354765f 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -447,7 +447,8 @@
if (itemViewType == PhoneFavoritesTileAdapter.ViewTypes.TOP) {
// This is a tiled row, so save horizontal offsets instead
saveHorizontalOffsets((ContactTileRow) child, (ArrayList<ContactEntry>)
- mAdapter.getItem(position), position);
+ mAdapter.getItem(position),
+ mAdapter.getAdjustedPositionInContactTileAdapter(position));
}
if (DEBUG) {
Log.d(TAG, "Saving itemId: " + itemId + " for listview child " + i + " Top: "
@@ -506,7 +507,6 @@
int left = child.getLeft();
Integer startRow = mItemIdTopMap.get(itemId);
-
if (startRow != null) {
if (startRow > currentRow) {
// Item has shifted upwards to the previous row.
@@ -535,10 +535,6 @@
animators.add(ObjectAnimator.ofFloat(
child, "translationX", delta, 0.0f));
}
- } else {
- // In case the last square row is pushed up from the non-square section.
- animators.add(ObjectAnimator.ofFloat(
- child, "translationX", left, 0.0f));
}
}
}
@@ -580,7 +576,7 @@
// This is a tiled row, so perform horizontal animations instead
performHorizontalAnimations((ContactTileRow) child, (
ArrayList<ContactEntry>) mAdapter.getItem(position), idsInPlace,
- position);
+ mAdapter.getAdjustedPositionInContactTileAdapter(position));
}
final long itemId = mAdapter.getItemId(position);
@@ -610,11 +606,6 @@
}
startTop = top + (i > 0 ? itemHeight : -itemHeight);
delta = startTop - top;
- } else {
- // In case the first non-square row is pushed down
- // from the square section.
- animators.add(ObjectAnimator.ofFloat(
- child, "alpha", 0.0f, 1.0f));
}
if (DEBUG) {
Log.d(TAG, "Found itemId: " + itemId + " for listview child " + i +
@@ -673,12 +664,12 @@
/**
* Prepares the favorites menu which contains the static label "Speed Dial" and the
- * "All Contacts" button. Taps anywhere in the view take the user to "All Contacts".
- * This emulates how the headers in Play Store work.
+ * "All Contacts" button. Sets the onClickListener for the "All Contacts" button.
*/
private void prepareFavoritesMenu(View favoritesMenu) {
- // Set the onClick listener for the view to bring up the all contacts view.
- favoritesMenu.setOnClickListener(new OnClickListener() {
+ 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() {
@Override
public void onClick(View view) {
showAllContacts();
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index 7d5dba2..e09fc7d 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -144,7 +144,7 @@
}
}
// Set position to the position of the actual favorite contact in the favorites adapter
- position = getAdjustedFavoritePosition(position, callLogAdapterCount);
+ position = getAdjustedPositionInContactTileAdapter(position);
return mContactTileAdapter.getItem(position);
}
@@ -176,7 +176,7 @@
} else if (position < (callLogAdapterCount + mContactTileAdapter.getCount() +
getTeaserViewCount() + 1)) {
return mContactTileAdapter.getItemId(
- getAdjustedFavoritePosition(position, callLogAdapterCount));
+ getAdjustedPositionInContactTileAdapter(position));
} else {
// Default fallback. We don't normally get here.
return FAVORITES_MENU_ITEM_ID;
@@ -216,7 +216,7 @@
return mContactTileAdapter.getViewTypeCount() + 3;
} else if (position < getCount()) {
return mContactTileAdapter.getItemViewType(
- getAdjustedFavoritePosition(position, callLogAdapterCount));
+ getAdjustedPositionInContactTileAdapter(position));
} else {
// Catch-all - we shouldn't get here but if we do use the same as the favorites menu.
return mContactTileAdapter.getViewTypeCount() + 3;
@@ -269,7 +269,7 @@
// Set position to the position of the actual favorite contact in the favorites adapter.
// Adjusts based on the presence of other views, such as the favorites menu.
- position = getAdjustedFavoritePosition(position, callLogAdapterCount);
+ position = getAdjustedPositionInContactTileAdapter(position);
// Favorites section
final View view = mContactTileAdapter.getView(position, convertView, parent);
@@ -296,18 +296,19 @@
return mCallLogAdapter.isEnabled(position);
} else { // For favorites section
return mContactTileAdapter.isEnabled(
- getAdjustedFavoritePosition(position, callLogAdapterCount));
+ getAdjustedPositionInContactTileAdapter(position));
}
}
/**
- * Determines the index into the mContactTileAdapter for the current position.
+ * Given the current position in the merged adapter, return the index in the
+ * mContactTileAdapter this position corresponds to.
*
- * @param position current position in the overall adapter.
- * @param callLogAdapterCount number of entries in "last calls" list (ie 0 or 1).
+ * @param position current position in the overall (merged) adapter.
* @return position in the mContactTileAdapter.
*/
- private int getAdjustedFavoritePosition(int position, int callLogAdapterCount) {
+ public int getAdjustedPositionInContactTileAdapter(int position) {
+ final int callLogAdapterCount = mCallLogAdapter.getCount();
if (position - callLogAdapterCount > TILE_INTERACTION_TEASER_VIEW_POSITION &&
mTileInteractionTeaserView.getShouldDisplayInList()) {
return position - callLogAdapterCount - 2;
diff --git a/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java b/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java
index e855c88..181d602 100644
--- a/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteSquareTileView.java
@@ -62,24 +62,12 @@
public void loadFromContact(ContactEntry entry) {
super.loadFromContact(entry);
if (entry != null) {
- final boolean contactIsFavorite = entry.isFavorite;
- mSecondaryButton.setVisibility(contactIsFavorite ? GONE : VISIBLE);
-
- if (contactIsFavorite) {
- mStarView.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- launchQuickContact();
- }
- });
- } else {
- mSecondaryButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- launchQuickContact();
- }
- });
- }
+ mSecondaryButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ launchQuickContact();
+ }
+ });
}
}
}
diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java
index ecf5616..16bf629 100644
--- a/src/com/android/dialer/list/PhoneFavoriteTileView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java
@@ -24,13 +24,12 @@
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.GestureDetector;
-import android.view.MotionEvent;
import android.view.View;
-import android.widget.ImageView;
+import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.MoreContactUtils;
+import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.list.ContactEntry;
import com.android.contacts.common.list.ContactTileView;
import com.android.dialer.R;
@@ -49,6 +48,12 @@
private static final String TAG = PhoneFavoriteTileView.class.getSimpleName();
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
+ // 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_SCALE = 0.70f;
+
/** Length of all animations in miniseconds. */
private int mAnimationDuration;
@@ -60,8 +65,8 @@
private View mUndoRemovalButton;
/** The view that holds the list view row. */
protected ContactTileRow mParentRow;
- /** The view that indicates whether the contact is a favorate. */
- protected ImageView mStarView;
+ /** View that contains the transparent shadow that is overlaid on top of the contact image. */
+ private View mShadowOverlay;
/** Users' most frequent phone number. */
private String mPhoneNumberString;
@@ -85,11 +90,10 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mFavoriteContactCard = findViewById(com.android.dialer.R.id.contact_favorite_card);
- mRemovalDialogue = findViewById(com.android.dialer.R.id.favorite_remove_dialogue);
- mUndoRemovalButton = findViewById(com.android.dialer.R.id
- .favorite_remove_undo_button);
- mStarView = (ImageView) findViewById(com.android.dialer.R.id.contact_favorite_star);
+ mShadowOverlay = findViewById(R.id.shadow_overlay);
+ mFavoriteContactCard = findViewById(R.id.contact_favorite_card);
+ mRemovalDialogue = findViewById(R.id.favorite_remove_dialogue);
+ mUndoRemovalButton = findViewById(R.id.favorite_remove_undo_button);
mUndoRemovalButton.setOnClickListener(new OnClickListener() {
@Override
@@ -127,7 +131,6 @@
// Grab the phone-number to call directly... see {@link onClick()}
mPhoneNumberString = entry.phoneNumber;
- mStarView.setVisibility(entry.isFavorite ? VISIBLE : GONE);
// If this is a blank entry, don't show anything.
// TODO krelease:Just hide the view for now. For this to truly look like an empty row
// the entire ContactTileRow needs to be hidden.
@@ -240,4 +243,18 @@
}
};
}
+
+ @Override
+ protected DefaultImageRequest getDefaultImageRequest(String displayName, String lookupKey) {
+ return new DefaultImageRequest(displayName, lookupKey, ContactPhotoManager.TYPE_DEFAULT,
+ DEFAULT_IMAGE_LETTER_SCALE, DEFAULT_IMAGE_LETTER_OFFSET);
+ }
+
+ @Override
+ protected void configureViewForImage(boolean isDefaultImage) {
+ // Hide the shadow overlay if the image is a default image (i.e. colored letter tile)
+ if (mShadowOverlay != null) {
+ mShadowOverlay.setVisibility(isDefaultImage ? View.GONE : View.VISIBLE);
+ }
+ }
}
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 45cc5a3..d1ac955 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -298,7 +298,8 @@
contact.name = (!TextUtils.isEmpty(name)) ? name :
mResources.getString(R.string.missing_name);
contact.photoUri = (photoUri != null ? Uri.parse(photoUri) : null);
- contact.lookupKey = ContentUris.withAppendedId(
+ contact.lookupKey = lookupKey;
+ contact.lookupUri = ContentUris.withAppendedId(
Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);
contact.isFavorite = isStarred;
contact.isDefaultNumber = isDefaultNumber;
@@ -667,7 +668,7 @@
boolean removed = false;
if (isIndexInBound(mPotentialRemoveEntryIndex)) {
final ContactEntry entry = mContactEntries.get(mPotentialRemoveEntryIndex);
- unstarAndUnpinContact(entry.lookupKey);
+ unstarAndUnpinContact(entry.lookupUri);
removed = true;
mAwaitingRemove = true;
}
@@ -1234,7 +1235,7 @@
@Override
public void onDroppedOnRemove() {
if (mDraggedEntry != null) {
- unstarAndUnpinContact(mDraggedEntry.lookupKey);
+ unstarAndUnpinContact(mDraggedEntry.lookupUri);
mAwaitingRemove = true;
}
}
diff --git a/src/com/android/dialer/service/CachedNumberLookupService.java b/src/com/android/dialer/service/CachedNumberLookupService.java
index 5745c9d..73fd895 100644
--- a/src/com/android/dialer/service/CachedNumberLookupService.java
+++ b/src/com/android/dialer/service/CachedNumberLookupService.java
@@ -33,6 +33,8 @@
public boolean isCacheUri(String uri);
+ public boolean isBusiness(int sourceType);
+
public boolean addPhoto(Context context, String number, byte[] photo);
/**
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
index 1dbae65..826dec0 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
@@ -74,7 +74,9 @@
};
private VoicemailPlaybackPresenter mPresenter;
- private ScheduledExecutorService mScheduledExecutorService;
+ private static int mMediaPlayerRefCount = 0;
+ private static MediaPlayerProxy mMediaPlayerInstance;
+ private static ScheduledExecutorService mScheduledExecutorService;
private View mPlaybackLayout;
@Override
@@ -87,7 +89,6 @@
@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);
@@ -99,8 +100,8 @@
powerManager.newWakeLock(
PowerManager.SCREEN_DIM_WAKE_LOCK, getClass().getSimpleName());
mPresenter = new VoicemailPlaybackPresenter(createPlaybackViewImpl(),
- createMediaPlayer(mScheduledExecutorService), voicemailUri,
- mScheduledExecutorService, startPlayback,
+ getMediaPlayerInstance(), voicemailUri,
+ getScheduledExecutorServiceInstance(), startPlayback,
AsyncTaskExecutors.createAsyncTaskExecutor(), wakeLock);
mPresenter.onCreate(savedInstanceState);
}
@@ -113,8 +114,8 @@
@Override
public void onDestroy() {
+ shutdownMediaPlayer();
mPresenter.onDestroy();
- mScheduledExecutorService.shutdown();
super.onDestroy();
}
@@ -129,12 +130,36 @@
mPlaybackLayout);
}
- private MediaPlayerProxy createMediaPlayer(ExecutorService executorService) {
- return VariableSpeed.createVariableSpeed(executorService);
+ private static synchronized MediaPlayerProxy getMediaPlayerInstance() {
+ ++mMediaPlayerRefCount;
+ if (mMediaPlayerInstance == null) {
+ mMediaPlayerInstance = VariableSpeed.createVariableSpeed(
+ getScheduledExecutorServiceInstance());
+ }
+ return mMediaPlayerInstance;
}
- private ScheduledExecutorService createScheduledExecutorService() {
- return Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL);
+ 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;
+ }
}
/**
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
index ebda0eb..085ef66 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
@@ -35,6 +35,7 @@
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;
@@ -311,6 +312,7 @@
mPlayer.setDataSource(mView.getDataSourceContext(), mVoicemailUri);
mPlayer.setAudioStreamType(PLAYBACK_STREAM);
mPlayer.prepare();
+ mDuration.set(mPlayer.getDuration());
return null;
} catch (Exception e) {
return e;
@@ -344,7 +346,7 @@
mView.setSpeakerPhoneOn(mView.isSpeakerPhoneOn());
mView.setRateDecreaseButtonListener(createRateDecreaseListener());
mView.setRateIncreaseButtonListener(createRateIncreaseListener());
- mView.setClipPosition(0, mPlayer.getDuration());
+ mView.setClipPosition(0, mDuration.get());
mView.playbackStopped();
// Always disable on stop.
mView.disableProximitySensor();
@@ -363,6 +365,10 @@
}
public void onDestroy() {
+ if (mPrepareTask != null) {
+ mPrepareTask.cancel(false);
+ mPrepareTask = null;
+ }
mPlayer.release();
if (mFetchResultHandler != null) {
mFetchResultHandler.destroy();
@@ -430,49 +436,67 @@
}
}
+ 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 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);
- }
- }
- });
+ new AsyncPrepareTask(clipPositionInMillis));
}
private void handleError(Exception e) {
@@ -598,6 +622,7 @@
synchronized (mLock) {
if (mScheduledFuture != null) {
mScheduledFuture.cancel(false);
+ mScheduledFuture = null;
}
mScheduledFuture = mExecutorService.scheduleAtFixedRate(this, 0, mPeriodMillis,
TimeUnit.MILLISECONDS);
@@ -620,6 +645,7 @@
}
if (mPrepareTask != null) {
mPrepareTask.cancel(false);
+ mPrepareTask = null;
}
if (mWakeLock.isHeld()) {
mWakeLock.release();
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index 6f5a986..9b7d9de 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -335,6 +335,6 @@
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION,
- name, 0, "", null, null));
+ name, 0, "", null, null, 0));
}
}