summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/speeddial
diff options
context:
space:
mode:
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