summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/speeddial
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2018-05-01 13:46:37 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-05-01 13:46:37 +0000
commitcccd332af6185505101df03ebee11923d7ee5fd4 (patch)
treeb70c83971f5281b4afc9e2d0534da21c8d5fbc6a /java/com/android/dialer/speeddial
parenteac73f3067acefffaa8eec7b7a9d8b3cc176e674 (diff)
parent2e36647b63e859c299d8242736226c00071836d9 (diff)
Merge changes If140d716,I89a186fa,Iee4e5c09,I5df97f0c,I55f75dc3, ...
* changes: Don't start emergency call in background calling mode. Make call configuration package visibility public. Don't save transcript if it's empty. Cancel all legacy voicemail notification when SIMs are removed on multi-SIM devices Fix bug that transcript button is visible for voice call. Refactor PreferredAccountWorker to provide the dialog to be shown. Fix bug that displaying local message is not in sync. Don't show dialog if in call activity is not visible. Bubble changes for background calling. Store RTT transcript message received when UI is in background. Update RTT transcript advisory text. Implement "Add to favorites" option in suggestions menu.
Diffstat (limited to 'java/com/android/dialer/speeddial')
-rw-r--r--java/com/android/dialer/speeddial/SpeedDialFragment.java37
-rw-r--r--java/com/android/dialer/speeddial/res/values/strings.xml3
2 files changed, 39 insertions, 1 deletions
diff --git a/java/com/android/dialer/speeddial/SpeedDialFragment.java b/java/com/android/dialer/speeddial/SpeedDialFragment.java
index 97a5facab..17591aa6c 100644
--- a/java/com/android/dialer/speeddial/SpeedDialFragment.java
+++ b/java/com/android/dialer/speeddial/SpeedDialFragment.java
@@ -350,7 +350,7 @@ public class SpeedDialFragment extends Fragment {
modules.add(new DividerModule());
- // TODO(calderwoodra): add to favorites module
+ modules.add(new StarContactModule(speedDialUiItem));
// TODO(calderwoodra): remove from strequent module
// Contact info module
@@ -384,6 +384,41 @@ public class SpeedDialFragment extends Fragment {
.setIsVideoCall(channel.isVideoTechnology()));
}
+ private final class StarContactModule implements HistoryItemActionModule {
+
+ private final SpeedDialUiItem speedDialUiItem;
+
+ StarContactModule(SpeedDialUiItem speedDialUiItem) {
+ this.speedDialUiItem = speedDialUiItem;
+ }
+
+ @Override
+ public int getStringId() {
+ return R.string.suggested_contact_bottom_sheet_add_favorite_option;
+ }
+
+ @Override
+ public int getDrawableId() {
+ return R.drawable.context_menu_contact_icon;
+ }
+
+ @Override
+ public boolean onClick() {
+ speedDialLoaderListener.listen(
+ getContext(),
+ UiItemLoaderComponent.get(getContext())
+ .speedDialUiItemMutator()
+ .starContact(
+ Uri.withAppendedPath(
+ Phone.CONTENT_FILTER_URI, speedDialUiItem.defaultChannel().number())),
+ SpeedDialFragment.this::onSpeedDialUiItemListLoaded,
+ throwable -> {
+ throw new RuntimeException(throwable);
+ });
+ return true;
+ }
+ }
+
private final class ContactInfoModule extends IntentModule {
public ContactInfoModule(Context context, Intent intent, int text, int image) {
diff --git a/java/com/android/dialer/speeddial/res/values/strings.xml b/java/com/android/dialer/speeddial/res/values/strings.xml
index 59a0ab5d6..028f6a90c 100644
--- a/java/com/android/dialer/speeddial/res/values/strings.xml
+++ b/java/com/android/dialer/speeddial/res/values/strings.xml
@@ -55,4 +55,7 @@
<!-- Text for a button that opens the contact's info [CHAR LIMIT=15]-->
<string name="contact_menu_contact_info">Contact info</string>
+
+ <!-- Text shown to the user in a button to prompt them to mark a contact as a favorite contact [CHAR LIMIT=30]. -->
+ <string name="suggested_contact_bottom_sheet_add_favorite_option">Add to favorites</string>
</resources> \ No newline at end of file