diff options
| author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-11-05 00:47:16 +0000 |
|---|---|---|
| committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-11-05 05:26:32 +0000 |
| commit | 3cb06ac57579ba579ba4954401a56cf93848d77f (patch) | |
| tree | 48fa4b8f245f175aba9aaa0652d2955e282a4449 | |
| parent | c05baae39c0d852656075d1eaca59d54ed905aa5 (diff) | |
| parent | 22d574bdded22377a7d1389df1491ace096d1848 (diff) | |
| download | packages_apps_Dialer-3cb06ac57579ba579ba4954401a56cf93848d77f.tar.gz packages_apps_Dialer-3cb06ac57579ba579ba4954401a56cf93848d77f.tar.bz2 packages_apps_Dialer-3cb06ac57579ba579ba4954401a56cf93848d77f.zip | |
Merge tag 'android-6.0.0_r26' into cm-13.0
Android 6.0.0 release 26
Change-Id: I2dce2b8ad58cd52f63a674c690971361b9b89e30
| -rw-r--r-- | AndroidManifest.xml | 12 | ||||
| -rw-r--r-- | res/layout/call_log_list_item_actions.xml | 14 | ||||
| -rw-r--r-- | res/menu/dialpad_options.xml | 5 | ||||
| -rw-r--r-- | res/values-es-rUS/strings.xml | 4 | ||||
| -rw-r--r-- | res/values-ja/strings.xml | 4 | ||||
| -rw-r--r-- | res/values-nl/strings.xml | 34 | ||||
| -rw-r--r-- | res/values-ro/strings.xml | 2 | ||||
| -rw-r--r-- | res/values-uz-rUZ/strings.xml | 2 | ||||
| -rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 3 | ||||
| -rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 9 | ||||
| -rw-r--r-- | src/com/android/dialer/calllog/CallLogListItemViewHolder.java | 46 | ||||
| -rw-r--r-- | src/com/android/dialer/calllog/ContactInfoHelper.java | 18 | ||||
| -rw-r--r-- | src/com/android/dialer/calllog/PhoneAccountUtils.java | 15 | ||||
| -rw-r--r-- | src/com/android/dialer/calllog/TelecomCallLogCache.java | 20 | ||||
| -rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 33 |
15 files changed, 152 insertions, 69 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 9569c1d00..4055b4441 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -16,7 +16,9 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer" - coreApp="true"> + coreApp="true" + android:versionCode="20210" + android:versionName="2.21"> <uses-sdk android:minSdkVersion="23" @@ -172,6 +174,14 @@ </intent-filter> </activity> + <activity android:name="com.android.contacts.common.dialog.CallSubjectDialog" + android:theme="@style/Theme.CallSubjectDialogTheme" + android:windowSoftInputMode="stateVisible|adjustResize"> + <intent-filter> + <action android:name="android.intent.action.VIEW"/> + </intent-filter> + </activity> + <!-- Backwards compatibility: "Phone" from Gingerbread and earlier --> <activity-alias android:name="DialtactsActivity" android:targetActivity=".DialtactsActivity" diff --git a/res/layout/call_log_list_item_actions.xml b/res/layout/call_log_list_item_actions.xml index b42720655..16a712bcd 100644 --- a/res/layout/call_log_list_item_actions.xml +++ b/res/layout/call_log_list_item_actions.xml @@ -105,6 +105,20 @@ </LinearLayout> <LinearLayout + android:id="@+id/call_with_note_action" + style="@style/CallLogActionStyle"> + + <ImageView + style="@style/CallLogActionIconStyle" + android:src="@drawable/ic_call_note_white_24dp" /> + + <TextView + style="@style/CallLogActionTextStyle" + android:text="@string/call_with_a_note" /> + + </LinearLayout> + + <LinearLayout android:id="@+id/details_action" style="@style/CallLogActionStyle"> diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml index f0399a82b..63fca07da 100644 --- a/res/menu/dialpad_options.xml +++ b/res/menu/dialpad_options.xml @@ -23,5 +23,8 @@ android:id="@+id/menu_add_wait" android:title="@string/add_wait" android:showAsAction="withText" /> - + <item + android:id="@+id/menu_call_with_note" + android:title="@string/call_with_a_note" + android:showAsAction="withText" /> </menu> diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml index 166654bfe..a6e22283e 100644 --- a/res/values-es-rUS/strings.xml +++ b/res/values-es-rUS/strings.xml @@ -59,8 +59,8 @@ <string name="voicemail_status_action_configure" msgid="8671796489912239589">"Configurar"</string> <string name="voicemail_status_action_call_server" msgid="1824816252288551794">"Llamar buzón de voz"</string> <string name="call_log_item_count_and_date" msgid="7641933305703520787">"(<xliff:g id="COUNT">%1$d</xliff:g>) <xliff:g id="DATE">%2$s</xliff:g>"</string> - <string name="sms_disambig_title" msgid="5846266399240630846">"Elije un número"</string> - <string name="call_disambig_title" msgid="4392886850104795739">"Elije un número"</string> + <string name="sms_disambig_title" msgid="5846266399240630846">"Elige un número"</string> + <string name="call_disambig_title" msgid="4392886850104795739">"Elige un número"</string> <string name="make_primary" msgid="5829291915305113983">"Recuerda esta opción"</string> <string name="description_search_button" msgid="3660807558587384889">"búsqueda"</string> <string name="description_dial_button" msgid="1274091017188142646">"marcar"</string> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 70e2b0cd4..efa4fbd2a 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -110,7 +110,7 @@ <string name="menu_callNumber" msgid="997146291983360266">"<xliff:g id="NUMBER">%s</xliff:g>に発信"</string> <string name="unknown" msgid="740067747858270469">"通知不可能"</string> <string name="voicemail" msgid="3851469869202611441">"ボイスメール"</string> - <string name="private_num" msgid="6374339738119166953">"非通知"</string> + <string name="private_num" msgid="6374339738119166953">"非通知設定"</string> <string name="payphone" msgid="7726415831153618726">"公衆電話"</string> <string name="callDetailsShortDurationFormat" msgid="3988146235579303592">"<xliff:g id="SECONDS">%s</xliff:g>秒"</string> <string name="callDetailsDurationFormat" msgid="6061406028764382234">"<xliff:g id="MINUTES">%s</xliff:g>分<xliff:g id="SECONDS">%s</xliff:g>秒"</string> @@ -190,7 +190,7 @@ <string name="sounds_and_vibration_title" msgid="1692290115642160845">"音とバイブレーション"</string> <string name="accessibility_settings_title" msgid="6068141142874046249">"ユーザー補助機能"</string> <string name="ringtone_title" msgid="760362035635084653">"着信音"</string> - <string name="vibrate_on_ring_title" msgid="3362916460327555241">"着信時もバイブレーションON"</string> + <string name="vibrate_on_ring_title" msgid="3362916460327555241">"着信時にバイブレーションもON"</string> <string name="dtmf_tone_enable_title" msgid="6571449695997521615">"ダイヤルパッドの音"</string> <string name="dtmf_tone_length_title" msgid="8581125689808919460">"ダイヤルパッドの音の長さ"</string> <string-array name="dtmf_tone_length_entries"> diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 11721f879..c40e404fc 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -29,10 +29,10 @@ <string name="recentCalls_deleteAll" msgid="5157887960461979812">"Oproepgeschiedenis wissen"</string> <string name="recentCalls_trashVoicemail" msgid="7604696960787435655">"Voicemail verwijderen"</string> <string name="recentCalls_shareVoicemail" msgid="1416112847592942840">"Voicemail delen"</string> - <string name="recentCalls_empty" msgid="5934808652605981210">"Uw gesprekkenlijst is leeg"</string> + <string name="recentCalls_empty" msgid="5934808652605981210">"Je gesprekkenlijst is leeg"</string> <string name="recentCalls_empty_action" msgid="6033275870727664335">"Bellen"</string> <string name="clearCallLogConfirmation_title" msgid="801753155679372984">"Oproepgeschiedenis wissen?"</string> - <string name="clearCallLogConfirmation" msgid="7899552396101432827">"Hiermee worden alle oproepen uit uw geschiedenis verwijderd"</string> + <string name="clearCallLogConfirmation" msgid="7899552396101432827">"Hiermee worden alle oproepen uit je geschiedenis verwijderd"</string> <string name="clearCallLogProgress_title" msgid="3372471156216306132">"Oproepgeschiedenis wissen…"</string> <plurals name="notification_voicemail_title" formatted="false" msgid="9088953961148324851"> <item quantity="other"> <xliff:g id="COUNT">%1$d</xliff:g> voicemails </item> @@ -50,11 +50,11 @@ <string name="call_log_outgoing_header" msgid="761009180766735769">"Alleen uitgaande oproepen"</string> <string name="call_log_missed_header" msgid="8017148056610855956">"Alleen gemiste oproepen"</string> <string name="visual_voicemail_title" msgid="4574199312906348905">"Visuele voicemail"</string> - <string name="visual_voicemail_text" msgid="164967285234132509">"Bekijk en beluister uw voicemail, zonder dat u een nummer hoeft te bellen. Er kunnen kosten voor gegevensgebruik in rekening worden gebracht."</string> + <string name="visual_voicemail_text" msgid="164967285234132509">"Bekijk en beluister je voicemail, zonder dat je een nummer hoeft te bellen. Er kunnen kosten voor gegevensgebruik in rekening worden gebracht."</string> <string name="visual_voicemail_settings" msgid="8090338793118794741">"Instellingen"</string> <string name="voicemail_status_voicemail_not_available" msgid="5222480147701456390">"Voicemailupdates niet beschikbaar"</string> - <string name="voicemail_status_messages_waiting" msgid="6329544650250068650">"U heeft nieuwe voicemail. Kan nu niet laden."</string> - <string name="voicemail_status_configure_voicemail" msgid="8300808991932816153">"Uw voicemail instellen"</string> + <string name="voicemail_status_messages_waiting" msgid="6329544650250068650">"Je hebt nieuwe voicemail. Kan nu niet laden."</string> + <string name="voicemail_status_configure_voicemail" msgid="8300808991932816153">"Je voicemail instellen"</string> <string name="voicemail_status_audio_not_available" msgid="2449801102560158082">"Audio niet beschikbaar"</string> <string name="voicemail_status_action_configure" msgid="8671796489912239589">"Instellen"</string> <string name="voicemail_status_action_call_server" msgid="1824816252288551794">"Bellen met voicemail"</string> @@ -115,8 +115,8 @@ <string name="callDetailsShortDurationFormat" msgid="3988146235579303592">"<xliff:g id="SECONDS">%s</xliff:g> sec."</string> <string name="callDetailsDurationFormat" msgid="6061406028764382234">"<xliff:g id="MINUTES">%s</xliff:g> min. <xliff:g id="SECONDS">%s</xliff:g> sec."</string> <string name="dialog_phone_call_prohibited_message" msgid="5730565540182492608">"Kan dit nummer niet bellen"</string> - <string name="dialog_voicemail_not_ready_message" msgid="4384716252789515378">"Voor het instellen van voicemail, gaat u naar \'Menu\' > \'Instellingen\'."</string> - <string name="dialog_voicemail_airplane_mode_message" msgid="530922773669546093">"Als u uw voicemail wilt bellen, moet u eerst de Vliegtuigmodus uitschakelen."</string> + <string name="dialog_voicemail_not_ready_message" msgid="4384716252789515378">"Voor het instellen van voicemail, ga je naar \'Menu\' > \'Instellingen\'."</string> + <string name="dialog_voicemail_airplane_mode_message" msgid="530922773669546093">"Als je je voicemail wilt bellen, moet je eerst de Vliegtuigmodus uitschakelen."</string> <string name="contact_list_loading" msgid="5488620820563977329">"Laden..."</string> <string name="imei" msgid="3045126336951684285">"IMEI-nummer"</string> <string name="meid" msgid="6210568493746275750">"MEID"</string> @@ -127,8 +127,8 @@ <string name="call_not_available" msgid="8941576511946492225">"Kan niet bellen omdat de Telefoon-app is uitgeschakeld."</string> <string name="activity_not_available" msgid="2287665636817987623">"Daarvoor is geen app beschikbaar op dit apparaat"</string> <string name="dialer_hint_find_contact" msgid="1012544667033887519">"Geef een naam of telefoonnummer op"</string> - <string name="recentMissed_empty" msgid="6213733029875741604">"U heeft geen gemiste oproepen."</string> - <string name="recentVoicemails_empty" msgid="7345542764648856330">"Uw voicemail-inbox is leeg."</string> + <string name="recentMissed_empty" msgid="6213733029875741604">"Je hebt geen gemiste oproepen."</string> + <string name="recentVoicemails_empty" msgid="7345542764648856330">"Je voicemail-inbox is leeg."</string> <string name="show_favorites_only" msgid="5520072531022614595">"Alleen favorieten weergeven"</string> <string name="call_log_activity_title" msgid="4612824396355272023">"Geschiedenis"</string> <string name="call_log_all_title" msgid="3566738938889333307">"Alle"</string> @@ -147,9 +147,9 @@ <string name="search_shortcut_make_video_call" msgid="1265971685034465166">"Videogesprek starten"</string> <string name="show_call_history" msgid="1141502332266697170">"Volledige oproepgeschiedenis bekijken"</string> <string name="num_missed_calls" msgid="8081736535604293886">"<xliff:g id="NUMBER">%s</xliff:g> nieuwe gemiste oproepen"</string> - <string name="speed_dial_empty" msgid="8838921693673366129">"Er staat nog niemand in uw snelkeuzelijst"</string> + <string name="speed_dial_empty" msgid="8838921693673366129">"Er staat nog niemand in je snelkeuzelijst"</string> <string name="speed_dial_empty_add_favorite_action" msgid="7944893641496695770">"Een favoriet toevoegen"</string> - <string name="all_contacts_empty" msgid="471370638298229686">"U heeft nog geen contacten"</string> + <string name="all_contacts_empty" msgid="471370638298229686">"Je hebt nog geen contacten"</string> <string name="all_contacts_empty_add_contact_action" msgid="1515782853819374618">"Contact toevoegen"</string> <string name="contact_tooltip" msgid="2019777545923635266">"Tik op de afbeelding om alle nummers te bekijken of blijf de afbeelding aanraken om opnieuw te rangschikken"</string> <string name="remove_contact" msgid="1080555335283662961">"Verwijderen"</string> @@ -202,11 +202,11 @@ <string name="phone_account_settings_label" msgid="5864322009841175294">"Oproepaccounts"</string> <string name="permission_single_turn_on" msgid="1543391076065465464">"Inschakelen"</string> <string name="permission_multiple_turn_on" msgid="2426278457455950554">"Toestemmingen instellen"</string> - <string name="permission_no_speeddial" msgid="7449042208802130085">"Als u de snelkeuzefunctie wilt inschakelen,\n schakelt u de contacttoestemming in."</string> - <string name="permission_no_calllog" msgid="8969825954337678018">"Als u uw gesprekkenlijst wilt bekijken,\n schakelt u de telefoontoestemming in."</string> - <string name="permission_no_contacts" msgid="4427828429876890950">"Als u uw contacten wilt bekijken,\n schakelt u de contacttoestemming in."</string> - <string name="permission_no_voicemail" msgid="7785949850839671813">"Als u uw voicemail wilt beluisteren,\n schakelt u de telefoontoestemming in."</string> - <string name="permission_no_search" msgid="84152933267902056">"Als u naar contacten wilt zoeken, schakelt u de contacttoestemming in."</string> - <string name="permission_place_call" msgid="7588803619716288478">"Als u iemand wilt bellen,\n schakelt u de telefoontoestemming in."</string> + <string name="permission_no_speeddial" msgid="7449042208802130085">"Als je de snelkeuzefunctie wilt inschakelen,\n schakel je de contacttoestemming in."</string> + <string name="permission_no_calllog" msgid="8969825954337678018">"Als je je gesprekkenlijst wilt bekijken,\n schakel je de telefoontoestemming in."</string> + <string name="permission_no_contacts" msgid="4427828429876890950">"Als je je contacten wilt bekijken,\n schakel je de contacttoestemming in."</string> + <string name="permission_no_voicemail" msgid="7785949850839671813">"Als je je voicemail wilt beluisteren,\n schakel je de telefoontoestemming in."</string> + <string name="permission_no_search" msgid="84152933267902056">"Als je naar contacten wilt zoeken, schakel je de contacttoestemming in."</string> + <string name="permission_place_call" msgid="7588803619716288478">"Als je iemand wilt bellen,\n schakel je de telefoontoestemming in."</string> <string name="toast_cannot_write_system_settings" msgid="5614246168296606709">"Telefoon-app heeft geen toestemming om systeeminstellingen te schrijven."</string> </resources> diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 5f89c4d86..26af997c5 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -117,7 +117,7 @@ <string name="callDetailsDurationFormat" msgid="6061406028764382234">"<xliff:g id="MINUTES">%s</xliff:g> min. <xliff:g id="SECONDS">%s</xliff:g> sec."</string> <string name="dialog_phone_call_prohibited_message" msgid="5730565540182492608">"Nu puteți apela acest număr"</string> <string name="dialog_voicemail_not_ready_message" msgid="4384716252789515378">"Pentru a configura mesageria vocală, accesaţi Meniu > Setări."</string> - <string name="dialog_voicemail_airplane_mode_message" msgid="530922773669546093">"Pentru a apela mesageria vocală, mai întâi dezactivaţi modul Avion."</string> + <string name="dialog_voicemail_airplane_mode_message" msgid="530922773669546093">"Pentru a apela mesageria vocală, mai întâi dezactivați modul Avion."</string> <string name="contact_list_loading" msgid="5488620820563977329">"Se încarcă..."</string> <string name="imei" msgid="3045126336951684285">"IMEI"</string> <string name="meid" msgid="6210568493746275750">"MEID"</string> diff --git a/res/values-uz-rUZ/strings.xml b/res/values-uz-rUZ/strings.xml index d6ffed53e..346170045 100644 --- a/res/values-uz-rUZ/strings.xml +++ b/res/values-uz-rUZ/strings.xml @@ -130,7 +130,7 @@ <string name="recentMissed_empty" msgid="6213733029875741604">"Sizda hech qanday javobsiz qo‘ng‘iroq yo‘q."</string> <string name="recentVoicemails_empty" msgid="7345542764648856330">"Sizning ovozli pochta qutingiz bo‘m-bo‘sh."</string> <string name="show_favorites_only" msgid="5520072531022614595">"Faqat saralar ko‘rsatilsin"</string> - <string name="call_log_activity_title" msgid="4612824396355272023">"Tarix"</string> + <string name="call_log_activity_title" msgid="4612824396355272023">"Jurnal"</string> <string name="call_log_all_title" msgid="3566738938889333307">"Barchasi"</string> <string name="call_log_missed_title" msgid="4541142293870638971">"Javobsiz"</string> <string name="call_log_voicemail_title" msgid="940422274047025948">"Ovozli xabar"</string> diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index c6ec8e1a0..56f2cb1dc 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -50,6 +50,7 @@ import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.GeoUtil; import com.android.contacts.common.CallUtil; +import com.android.contacts.common.util.UriUtils; import com.android.dialer.calllog.CallDetailHistoryAdapter; import com.android.dialer.calllog.CallLogAsyncTaskUtil.CallLogAsyncTaskListener; import com.android.dialer.calllog.CallLogAsyncTaskUtil; @@ -162,7 +163,7 @@ public class CallDetailActivity extends Activity new CallDetailHistoryAdapter(mContext, mInflater, mCallTypeHelper, details)); String lookupKey = contactUri == null ? null - : ContactInfoHelper.getLookupKeyFromUri(contactUri); + : UriUtils.getLookupKeyFromUri(contactUri); final boolean isBusiness = mContactInfoHelper.isBusiness(firstDetails.sourceType); diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 85d1c383a..5a87bc8ce 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -22,6 +22,8 @@ import android.content.SharedPreferences; import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; +import android.provider.ContactsContract; +import android.provider.ContactsContract.CommonDataKinds.Phone; import android.support.v7.widget.RecyclerView; import android.os.Bundle; import android.os.Trace; @@ -526,13 +528,16 @@ public class CallLogAdapter extends GroupingListAdapter views.rowId = c.getLong(CallLogQuery.ID); // Store values used when the actions ViewStub is inflated on expansion. views.number = number; + views.displayNumber = details.displayNumber; views.numberPresentation = numberPresentation; views.callType = c.getInt(CallLogQuery.CALL_TYPE); views.accountHandle = accountHandle; views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI); // Stash away the Ids of the calls so that we can support deleting a row in the call log. views.callIds = getCallIds(c, count); - + views.isBusiness = mContactInfoHelper.isBusiness(info.sourceType); + views.numberType = (String) Phone.getTypeLabel(mContext.getResources(), details.numberType, + details.numberLabel); // Default case: an item in the call log. views.primaryActionView.setVisibility(View.VISIBLE); @@ -563,7 +568,7 @@ public class CallLogAdapter extends GroupingListAdapter nameForDefaultImage = info.name; } views.setPhoto(info.photoId, info.photoUri, info.lookupUri, nameForDefaultImage, - isVoicemailNumber, mContactInfoHelper.isBusiness(info.sourceType)); + isVoicemailNumber, views.isBusiness); mCallLogListItemHelper.setPhoneCallDetails(views, details); } diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java index 361e1c7a3..0fa5e6d33 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java +++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java @@ -16,6 +16,7 @@ package com.android.dialer.calllog; +import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.content.Intent; @@ -29,18 +30,16 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; -import android.view.ViewTreeObserver; import android.widget.QuickContactBadge; import android.widget.ImageView; import android.widget.TextView; -import com.android.contacts.common.CallUtil; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; +import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.testing.NeededForTesting; import com.android.contacts.common.util.UriUtils; import com.android.dialer.R; -import com.android.dialer.calllog.CallLogAsyncTaskUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; @@ -80,6 +79,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder public View addToExistingContactButtonView; public View sendMessageView; public View detailsButtonView; + public View callWithNoteButtonView; /** * The row Id for the first call associated with the call log entry. Used as a key for the @@ -100,12 +100,22 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder public String number; /** + * The formatted phone number to display. + */ + public String displayNumber; + + /** * The phone number presentation for the current call log entry. Cached here as the call back * intent is set only when the actions ViewStub is inflated. */ public int numberPresentation; /** + * The type of the phone number (e.g. main, work, etc). + */ + public String numberType; + + /** * The type of call for the current call log entry. Cached here as the call back * intent is set only when the actions ViewStub is inflated. */ @@ -131,6 +141,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder public CharSequence nameOrNumber; /** + * Whether this row is for a business or not. + */ + public boolean isBusiness; + + /** * The contact info for the contact displayed in this list item. */ public ContactInfo info; @@ -245,6 +260,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder detailsButtonView = actionsView.findViewById(R.id.details_action); detailsButtonView.setOnClickListener(this); + + callWithNoteButtonView = actionsView.findViewById(R.id.call_with_note_action); + callWithNoteButtonView.setOnClickListener(this); } bindActionButtons(); @@ -349,6 +367,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder sendMessageView.setTag(IntentProvider.getSendSmsIntentProvider(number)); mCallLogListItemHelper.setActionContentDescriptions(this); + + boolean supportsCallSubject = + mTelecomCallLogCache.doesAccountSupportCallSubject(accountHandle); + boolean isVoicemailNumber = + mTelecomCallLogCache.isVoicemailNumber(accountHandle, number); + callWithNoteButtonView.setVisibility( + supportsCallSubject && !isVoicemailNumber ? View.VISIBLE : View.GONE); } /** @@ -403,7 +428,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder String lookupKey = null; if (contactUri != null) { - lookupKey = ContactInfoHelper.getLookupKeyFromUri(contactUri); + lookupKey = UriUtils.getLookupKeyFromUri(contactUri); } DefaultImageRequest request = new DefaultImageRequest( @@ -423,6 +448,19 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder if (view.getId() == R.id.primary_action_button && !TextUtils.isEmpty(voicemailUri)) { mVoicemailPrimaryActionButtonClicked = true; mExpandCollapseListener.onClick(primaryActionView); + } else if (view.getId() == R.id.call_with_note_action) { + CallSubjectDialog.start( + (Activity) mContext, + info.photoId, + info.photoUri, + info.lookupUri, + (String) nameOrNumber /* top line of contact view in call subject dialog */, + isBusiness, + number, /* callable number used for ACTION_CALL intent */ + TextUtils.isEmpty(info.name) ? null : displayNumber, /* second line of contact + view in dialog. */ + numberType, /* phone number type (e.g. mobile) in second line of contact view */ + accountHandle); } else { final IntentProvider intentProvider = (IntentProvider) view.getTag(); if (intentProvider != null) { diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java index 20d33a003..2e07a03b1 100644 --- a/src/com/android/dialer/calllog/ContactInfoHelper.java +++ b/src/com/android/dialer/calllog/ContactInfoHelper.java @@ -394,24 +394,6 @@ public class ContactInfoHelper { } /** - * 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 : Uri.encode(segments.get(2)); - } else { - return null; - } - } - - /** * Returns the contact information stored in an entry of the call log. * * @param c A cursor pointing to an entry in the call log. diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java index 7eaa523f4..143d13e86 100644 --- a/src/com/android/dialer/calllog/PhoneAccountUtils.java +++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java @@ -84,6 +84,21 @@ public class PhoneAccountUtils { } /** + * Determine whether a phone account supports call subjects. + * + * @return {@code true} if call subjects are supported, {@code false} otherwise. + */ + public static boolean getAccountSupportsCallSubject(Context context, + PhoneAccountHandle accountHandle) { + TelecomManager telecomManager = + (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); + final PhoneAccount account = telecomManager.getPhoneAccount(accountHandle); + + return account == null ? false : + account.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT); + } + + /** * Retrieve the account metadata, but if the account does not exist or the device has only a * single registered and enabled account, return null. */ diff --git a/src/com/android/dialer/calllog/TelecomCallLogCache.java b/src/com/android/dialer/calllog/TelecomCallLogCache.java index ec1d24191..7071669e5 100644 --- a/src/com/android/dialer/calllog/TelecomCallLogCache.java +++ b/src/com/android/dialer/calllog/TelecomCallLogCache.java @@ -52,6 +52,7 @@ public class TelecomCallLogCache { new HashMap<>(); private final Map<PhoneAccountHandle, String> mPhoneAccountLabelCache = new HashMap<>(); private final Map<PhoneAccountHandle, Integer> mPhoneAccountColorCache = new HashMap<>(); + private final Map<PhoneAccountHandle, Boolean> mPhoneAccountCallWithNoteCache = new HashMap<>(); private boolean mHasCheckedForVideoEnabled; private boolean mIsVideoEnabled; @@ -64,6 +65,7 @@ public class TelecomCallLogCache { mVoicemailQueryCache.clear(); mPhoneAccountLabelCache.clear(); mPhoneAccountColorCache.clear(); + mPhoneAccountCallWithNoteCache.clear(); mHasCheckedForVideoEnabled = false; mIsVideoEnabled = false; @@ -121,4 +123,22 @@ public class TelecomCallLogCache { } return mIsVideoEnabled; } + + /** + * Determines if the PhoneAccount supports specifying a call subject (i.e. calling with a note) + * for outgoing calls. + * + * @param accountHandle The PhoneAccount handle. + * @return {@code true} if calling with a note is supported, {@code false} otherwise. + */ + public boolean doesAccountSupportCallSubject(PhoneAccountHandle accountHandle) { + if (mPhoneAccountCallWithNoteCache.containsKey(accountHandle)) { + return mPhoneAccountCallWithNoteCache.get(accountHandle); + } else { + Boolean supportsCallWithNote = + PhoneAccountUtils.getAccountSupportsCallSubject(mContext, accountHandle); + mPhoneAccountCallWithNoteCache.put(accountHandle, supportsCallWithNote); + return supportsCallWithNote; + } + } } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index d65e2ebfe..31a3feb30 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -50,6 +50,7 @@ import android.text.TextUtils; import android.text.TextWatcher; import android.util.AttributeSet; import android.util.Log; +import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; @@ -69,6 +70,7 @@ import android.widget.TextView; import com.android.contacts.common.CallUtil; import com.android.contacts.common.GeoUtil; +import com.android.contacts.common.dialog.CallSubjectDialog; import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.util.PhoneNumberFormatter; import com.android.contacts.common.util.StopWatch; @@ -81,7 +83,6 @@ import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import com.android.phone.common.CallLogAsync; -import com.android.phone.common.HapticFeedback; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.dialpad.DialpadKeyButton; import com.android.phone.common.dialpad.DialpadView; @@ -224,9 +225,6 @@ public class DialpadFragment extends Fragment // determines if we want to playback local DTMF tones. private boolean mDTMFToneEnabled; - // Vibration (haptic feedback) for dialer key presses. - private final HapticFeedback mHaptic = new HapticFeedback(); - /** Identifier for the "Add Call" intent extra. */ private static final String ADD_CALL_MODE_KEY = "add_call_mode"; @@ -359,13 +357,6 @@ public class DialpadFragment extends Fragment mCurrentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); - try { - mHaptic.init(getActivity(), - getResources().getBoolean(R.bool.config_enable_dialer_key_vibration)); - } catch (Resources.NotFoundException nfe) { - Log.e(TAG, "Vibrate control bool missing.", nfe); - } - mProhibitedPhoneNumberRegexp = getResources().getString( R.string.config_prohibited_phone_number_regexp); @@ -690,9 +681,6 @@ public class DialpadFragment extends Fragment stopWatch.lap("dtwd"); - // Retrieve the haptic feedback setting. - mHaptic.checkSystemSetting(); - stopWatch.lap("hptc"); mPressedDialpadKeys.clear(); @@ -826,7 +814,7 @@ public class DialpadFragment extends Fragment break; } - mHaptic.vibrate(); + getView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode); mDigits.onKeyDown(keyCode, event); @@ -937,9 +925,12 @@ public class DialpadFragment extends Fragment boolean enable = !isDigitsEmpty(); for (int i = 0; i < menu.size(); i++) { - menu.getItem(i).setEnabled(enable); + MenuItem item = menu.getItem(i); + item.setEnabled(enable); + if (item.getItemId() == R.id.menu_call_with_note) { + item.setVisible(CallUtil.isCallWithSubjectSupported(getContext())); + } } - super.show(); } }; @@ -953,7 +944,7 @@ public class DialpadFragment extends Fragment * pressed. */ public void dialButtonPressed() { - mHaptic.vibrate(); + getView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); handleDialButtonPressed(); } @@ -1025,7 +1016,7 @@ public class DialpadFragment extends Fragment public void onClick(View view) { switch (view.getId()) { case R.id.dialpad_floating_action_button: - mHaptic.vibrate(); + view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); handleDialButtonPressed(); break; case R.id.deleteButton: { @@ -1602,6 +1593,10 @@ public class DialpadFragment extends Fragment case R.id.menu_add_wait: updateDialString(WAIT); return true; + case R.id.menu_call_with_note: + CallSubjectDialog.start(getActivity(), mDigits.getText().toString()); + hideAndClearDialpad(false); + return true; default: return false; } |
