From 787095bf88505b4a7204aa3feaf1117deaf16ba1 Mon Sep 17 00:00:00 2001 From: Yvonne Wong Date: Wed, 11 May 2016 14:02:12 -0700 Subject: Add maps preview for addresses and integrate ridesharing request into Messaging - Uses the first map link found in a message to get a static map view - The static map view is shown as a preview and can be clicked to go into the default maps app - Clicking on request ride will lead the user to RideCoreUI with pickup location prefilled based on the address in the map link - Clicking on the directions button will lead the user to google maps's navigation - Display placeholder background when map is loading or offline with no cached image - Use RoundedCornerTransformation to transform the map into a bitmap with rounded corners - Show brand bitmap from ridesharing services if an active provider is chosen, otherwise display the generic ridesharing icon Change-Id: I8e74c6d9beeaa58f01f0a51e5a831c6697c890ea Issue-Id: RIDE-75, RIDE-76, RIDE-77 --- Android.mk | 8 +- res/drawable-hdpi/ic_map_placeholder.png | Bin 0 -> 9727 bytes res/drawable-mdpi/ic_map_placeholder.png | Bin 0 -> 5747 bytes res/drawable-xhdpi/ic_map_placeholder.png | Bin 0 -> 15806 bytes res/drawable-xxhdpi/ic_map_placeholder.png | Bin 0 -> 31660 bytes res/drawable/directions_button_background.xml | 6 + res/drawable/ic_generic_transport_icon.xml | 32 ++++ res/drawable/ic_get_directions.xml | 7 + res/drawable/maps_button_container_background.xml | 6 + res/drawable/request_ride_button_background.xml | 6 + res/layout/attachment_maps.xml | 81 +++++++++ res/layout/conversation_message_view.xml | 4 + res/values/cm_colors.xml | 5 + res/values/cm_dimens.xml | 19 ++ res/values/cm_strings.xml | 3 + res/values/google_maps_api.xml | 3 + src/com/android/messaging/ui/AsyncImageView.java | 2 - .../conversation/ConversationMessageAdapter.java | 4 + .../ui/conversation/ConversationMessageView.java | 196 +++++++++++++++++++-- .../messaging/util/GoogleStaticMapsUtil.java | 58 ++++++ .../messaging/util/RidesharingUtil.java | 112 ++++++++++++ .../util/RoundedCornerTransformation.java | 46 +++++ 22 files changed, 574 insertions(+), 24 deletions(-) create mode 100644 res/drawable-hdpi/ic_map_placeholder.png create mode 100644 res/drawable-mdpi/ic_map_placeholder.png create mode 100644 res/drawable-xhdpi/ic_map_placeholder.png create mode 100644 res/drawable-xxhdpi/ic_map_placeholder.png create mode 100644 res/drawable/directions_button_background.xml create mode 100644 res/drawable/ic_generic_transport_icon.xml create mode 100755 res/drawable/ic_get_directions.xml create mode 100644 res/drawable/maps_button_container_background.xml create mode 100644 res/drawable/request_ride_button_background.xml create mode 100644 res/layout/attachment_maps.xml create mode 100644 res/values/google_maps_api.xml create mode 100644 src/com/cyanogenmod/messaging/util/GoogleStaticMapsUtil.java create mode 100644 src/com/cyanogenmod/messaging/util/RidesharingUtil.java create mode 100644 src/com/cyanogenmod/messaging/util/RoundedCornerTransformation.java diff --git a/Android.mk b/Android.mk index 532752e..88b3239 100644 --- a/Android.mk +++ b/Android.mk @@ -51,6 +51,7 @@ LOCAL_STATIC_JAVA_LIBRARIES += guava LOCAL_STATIC_JAVA_LIBRARIES += libchips LOCAL_STATIC_JAVA_LIBRARIES += libphotoviewer LOCAL_STATIC_JAVA_LIBRARIES += libphonenumber +LOCAL_STATIC_JAVA_LIBRARIES += play LOCAL_STATIC_JAVA_LIBRARIES += colorpicker LOCAL_STATIC_JAVA_LIBRARIES += contacts-picaso @@ -67,6 +68,7 @@ LOCAL_AAPT_FLAGS += --extra-packages com.android.ex.photo LOCAL_AAPT_FLAGS += --extra-packages com.android.colorpicker LOCAL_AAPT_FLAGS += --extra-packages com.android.contacts.common LOCAL_AAPT_FLAGS += --extra-packages com.android.phone.common +LOCAT_AAPT_FLAGS += --extra-packages com.google.android.gms ifdef TARGET_BUILD_APPS LOCAL_JNI_SHARED_LIBRARIES := libframesequence libgiftranscode @@ -75,11 +77,7 @@ else endif # utilize ContactsCommon's phone-number-based contact-info lookup -ifeq ($(contacts_common_dir),) - contacts_common_dir := ../ContactsCommon -endif -CONTACTS_COMMON_LOOKUP_PROVIDER ?= $(LOCAL_PATH)/$(contacts_common_dir)/info_lookup -include $(CONTACTS_COMMON_LOOKUP_PROVIDER)/phonenumber_lookup_provider.mk +include $(LOCAL_PATH)/../ContactsCommon/info_lookup/phonenumber_lookup_provider.mk LOCAL_PROGUARD_FLAGS := -ignorewarnings -include build/core/proguard_basic_keeps.flags diff --git a/res/drawable-hdpi/ic_map_placeholder.png b/res/drawable-hdpi/ic_map_placeholder.png new file mode 100644 index 0000000..4b40b16 Binary files /dev/null and b/res/drawable-hdpi/ic_map_placeholder.png differ diff --git a/res/drawable-mdpi/ic_map_placeholder.png b/res/drawable-mdpi/ic_map_placeholder.png new file mode 100644 index 0000000..bd551a5 Binary files /dev/null and b/res/drawable-mdpi/ic_map_placeholder.png differ diff --git a/res/drawable-xhdpi/ic_map_placeholder.png b/res/drawable-xhdpi/ic_map_placeholder.png new file mode 100644 index 0000000..b6d5bf9 Binary files /dev/null and b/res/drawable-xhdpi/ic_map_placeholder.png differ diff --git a/res/drawable-xxhdpi/ic_map_placeholder.png b/res/drawable-xxhdpi/ic_map_placeholder.png new file mode 100644 index 0000000..8bba6c2 Binary files /dev/null and b/res/drawable-xxhdpi/ic_map_placeholder.png differ diff --git a/res/drawable/directions_button_background.xml b/res/drawable/directions_button_background.xml new file mode 100644 index 0000000..a40b30f --- /dev/null +++ b/res/drawable/directions_button_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/res/drawable/ic_generic_transport_icon.xml b/res/drawable/ic_generic_transport_icon.xml new file mode 100644 index 0000000..7bd5e2e --- /dev/null +++ b/res/drawable/ic_generic_transport_icon.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/res/drawable/ic_get_directions.xml b/res/drawable/ic_get_directions.xml new file mode 100755 index 0000000..46c6fb6 --- /dev/null +++ b/res/drawable/ic_get_directions.xml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/res/drawable/maps_button_container_background.xml b/res/drawable/maps_button_container_background.xml new file mode 100644 index 0000000..6e3a3a1 --- /dev/null +++ b/res/drawable/maps_button_container_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/res/drawable/request_ride_button_background.xml b/res/drawable/request_ride_button_background.xml new file mode 100644 index 0000000..ff3ba2e --- /dev/null +++ b/res/drawable/request_ride_button_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/res/layout/attachment_maps.xml b/res/layout/attachment_maps.xml new file mode 100644 index 0000000..4cb691f --- /dev/null +++ b/res/layout/attachment_maps.xml @@ -0,0 +1,81 @@ + + + + + +