summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Wei Liew <zhaoweiliew@gmail.com>2017-02-19 11:18:25 +0800
committerZhao Wei Liew <zhaoweiliew@gmail.com>2017-02-19 11:21:12 +0800
commita2766da1f197496e45234c7a2c3c18a81f804fc8 (patch)
tree075bc44f6947a35c91c7e97138053e57f3986d2b
parentf2597ce36785fda486fa7a911ec05147adcbbffe (diff)
downloadandroid_packages_apps_Messaging-a2766da1f197496e45234c7a2c3c18a81f804fc8.tar.gz
android_packages_apps_Messaging-a2766da1f197496e45234c7a2c3c18a81f804fc8.tar.bz2
android_packages_apps_Messaging-a2766da1f197496e45234c7a2c3c18a81f804fc8.zip
Revert "Add maps preview for addresses and integrate ridesharing request into Messaging"
Get rid of dependencies on the ambient SDK. This reverts commit 1a3b89e56b63270c0394f5b50cd4ce3081c1f7ee. Change-Id: Iad616b41bbeb71a785f45fa4a359fe305099ade0
-rw-r--r--Android.mk8
-rw-r--r--res/drawable-hdpi/ic_map_placeholder.pngbin9727 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_map_placeholder.pngbin5747 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_map_placeholder.pngbin15806 -> 0 bytes
-rw-r--r--res/drawable-xxhdpi/ic_map_placeholder.pngbin31660 -> 0 bytes
-rw-r--r--res/drawable/directions_button_background.xml6
-rw-r--r--res/drawable/ic_generic_transport_icon.xml32
-rwxr-xr-xres/drawable/ic_get_directions.xml7
-rw-r--r--res/drawable/maps_button_container_background.xml6
-rw-r--r--res/drawable/request_ride_button_background.xml6
-rw-r--r--res/layout/attachment_maps.xml81
-rw-r--r--res/layout/conversation_message_view.xml4
-rwxr-xr-xres/values/cm_colors.xml5
-rw-r--r--res/values/cm_dimens.xml19
-rw-r--r--res/values/cm_strings.xml3
-rw-r--r--res/values/google_maps_api.xml3
-rw-r--r--src/com/android/messaging/ui/AsyncImageView.java2
-rw-r--r--src/com/android/messaging/ui/conversation/ConversationMessageAdapter.java4
-rw-r--r--src/com/android/messaging/ui/conversation/ConversationMessageView.java196
-rw-r--r--src/com/cyanogenmod/messaging/util/GoogleStaticMapsUtil.java58
-rw-r--r--src/com/cyanogenmod/messaging/util/RidesharingUtil.java112
-rw-r--r--src/com/cyanogenmod/messaging/util/RoundedCornerTransformation.java46
22 files changed, 24 insertions, 574 deletions
diff --git a/Android.mk b/Android.mk
index 88b3239..532752e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -51,7 +51,6 @@ 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
@@ -68,7 +67,6 @@ 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
@@ -77,7 +75,11 @@ else
endif
# utilize ContactsCommon's phone-number-based contact-info lookup
-include $(LOCAL_PATH)/../ContactsCommon/info_lookup/phonenumber_lookup_provider.mk
+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
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
deleted file mode 100644
index 4b40b16..0000000
--- a/res/drawable-hdpi/ic_map_placeholder.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_map_placeholder.png b/res/drawable-mdpi/ic_map_placeholder.png
deleted file mode 100644
index bd551a5..0000000
--- a/res/drawable-mdpi/ic_map_placeholder.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_map_placeholder.png b/res/drawable-xhdpi/ic_map_placeholder.png
deleted file mode 100644
index b6d5bf9..0000000
--- a/res/drawable-xhdpi/ic_map_placeholder.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_map_placeholder.png b/res/drawable-xxhdpi/ic_map_placeholder.png
deleted file mode 100644
index 8bba6c2..0000000
--- a/res/drawable-xxhdpi/ic_map_placeholder.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/directions_button_background.xml b/res/drawable/directions_button_background.xml
deleted file mode 100644
index a40b30f..0000000
--- a/res/drawable/directions_button_background.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:bottomRightRadius="2dp" android:topRightRadius="2dp" />
- <solid android:color="@color/white_54" />
-</shape> \ No newline at end of file
diff --git a/res/drawable/ic_generic_transport_icon.xml b/res/drawable/ic_generic_transport_icon.xml
deleted file mode 100644
index 7bd5e2e..0000000
--- a/res/drawable/ic_generic_transport_icon.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (c) 2016 The CyanogenMod 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
-
- <path
- android:fillColor="#000000"
- android:pathData="M18.9,6c-0.2-0.6-0.8-1-1.4-1h-11C5.8,5,5.3,5.4,5.1,6L3,12v8c0,0.5,0.5,1,1,1h1c0.6,0,1-0.5,1-1v-1h12v1c0,0.5,0.5,1,1,1h1
-c0.5,0,1-0.5,1-1v-8L18.9,6z
-M6.5,16C5.7,16,5,15.3,5,14.5S5.7,13,6.5,13S8,13.7,8,14.5S7.3,16,6.5,16z M17.5,16
-c-0.8,0-1.5-0.7-1.5-1.5s0.7-1.5,1.5-1.5s1.5,0.7,1.5,1.5S18.3,16,17.5,16z
-M5,11l1.5-4.5h11L19,11H5z M11,9.5
-c0,0.8-0.7,1.5-1.5,1.5S8,10.3,8,9.5S8.7,8,9.5,8S11,8.7,11,9.5z
-M16,9.5c0,0.8-0.7,1.5-1.5,1.5S13,10.3,13,9.5S13.7,8,14.5,8 S16,8.7,16,9.5z" />
-</vector> \ No newline at end of file
diff --git a/res/drawable/ic_get_directions.xml b/res/drawable/ic_get_directions.xml
deleted file mode 100755
index 46c6fb6..0000000
--- a/res/drawable/ic_get_directions.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:height="24dp"
- android:width="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path android:fillColor="#000000" android:fillAlpha=".54" android:pathData="M14,14.5V12H10V15H8V11A1,1 0 0,1 9,10H14V7.5L17.5,11M21.71,11.29L12.71,2.29H12.7C12.31,1.9 11.68,1.9 11.29,2.29L2.29,11.29C1.9,11.68 1.9,12.32 2.29,12.71L11.29,21.71C11.68,22.09 12.31,22.1 12.71,21.71L21.71,12.71C22.1,12.32 22.1,11.68 21.71,11.29Z" />
-</vector> \ No newline at end of file
diff --git a/res/drawable/maps_button_container_background.xml b/res/drawable/maps_button_container_background.xml
deleted file mode 100644
index 6e3a3a1..0000000
--- a/res/drawable/maps_button_container_background.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:radius="2dp" />
- <solid android:color="@android:color/transparent" />
-</shape> \ No newline at end of file
diff --git a/res/drawable/request_ride_button_background.xml b/res/drawable/request_ride_button_background.xml
deleted file mode 100644
index ff3ba2e..0000000
--- a/res/drawable/request_ride_button_background.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <corners android:bottomLeftRadius="2dp" android:topLeftRadius="2dp" />
- <solid android:color="@color/white_54" />
-</shape> \ No newline at end of file
diff --git a/res/layout/attachment_maps.xml b/res/layout/attachment_maps.xml
deleted file mode 100644
index 4cb691f..0000000
--- a/res/layout/attachment_maps.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The CyanogenMod Project (DvTonder)
-
- 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.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:visibility="gone"
- android:layout_marginBottom="@dimen/conversation_maps_margin"
- android:layout_width="@dimen/conversation_maps_width"
- android:layout_height="@dimen/conversation_maps_height">
- <ImageView
- android:id="@+id/maps_image"
- android:layout_width="@dimen/conversation_maps_width"
- android:layout_height="@dimen/conversation_maps_height"
- android:minWidth="@dimen/conversation_maps_width"
- android:minHeight="@dimen/conversation_maps_height"
- android:adjustViewBounds="true"
- android:scaleType="centerInside"
- android:layout_gravity="center_vertical"/>
- <RelativeLayout
- android:background="@drawable/maps_button_container_background"
- android:elevation="@dimen/maps_button_elevation"
- android:layout_width="@dimen/maps_button_width"
- android:layout_height="@dimen/maps_button_height"
- android:layout_alignParentBottom="true"
- android:layout_marginLeft="@dimen/conversation_maps_margin"
- android:layout_marginBottom="@dimen/conversation_maps_margin"
- android:layout_marginRight="@dimen/conversation_maps_margin">
- <Button
- style="?android:attr/borderlessButtonStyle"
- android:id="@+id/request_ride_button"
- android:background="@drawable/request_ride_button_background"
- android:layout_alignParentLeft="true"
- android:layout_width="@dimen/request_ride_button_width"
- android:layout_height="match_parent"
- android:paddingLeft="28dp"
- android:paddingRight="50dp"
- android:textColor="@color/black_54"
- android:textSize="@dimen/request_ride_text_size"
- android:fontFamily="sans-serif-medium"
- android:text="@string/request_ride"/>
- <ImageView
- android:id="@+id/brand_image"
- android:layout_width="@dimen/brand_image_width"
- android:layout_height="@dimen/brand_image_height"
- android:layout_alignParentLeft="true"
- android:layout_marginLeft="@dimen/brand_image_margin"
- android:layout_marginRight="@dimen/brand_image_margin"
- android:layout_centerVertical="true"
- android:focusable="false"
- android:clickable="false"
- android:src="@drawable/ic_generic_transport_icon"/>
- <ImageView
- android:id="@+id/directions_button"
- android:layout_width="@dimen/directions_button_width"
- android:layout_height="match_parent"
- android:background="@drawable/directions_button_background"
- android:layout_alignParentRight="true"
- android:padding="@dimen/directions_button_padding"
- android:layout_centerVertical="true"
- android:src="@drawable/ic_get_directions"/>
- <View
- android:id="@+id/button_divider"
- android:layout_toRightOf="@id/request_ride_button"
- android:layout_toLeftOf="@id/directions_button"
- android:layout_width="@dimen/maps_button_divider_width"
- android:layout_height="match_parent"
- android:background="@color/transparent_gray" />
- </RelativeLayout>
-</RelativeLayout> \ No newline at end of file
diff --git a/res/layout/conversation_message_view.xml b/res/layout/conversation_message_view.xml
index 004028d..8d10c84 100644
--- a/res/layout/conversation_message_view.xml
+++ b/res/layout/conversation_message_view.xml
@@ -66,10 +66,6 @@
app:cornerRadius="@dimen/attachment_rounded_corner_radius"
android:contentDescription="@string/message_image_content_description" />
- <include
- android:id="@+id/message_maps"
- layout="@layout/attachment_maps" />
-
</LinearLayout>
<com.android.messaging.ui.conversation.MessageBubbleBackground
diff --git a/res/values/cm_colors.xml b/res/values/cm_colors.xml
index 3af3a08..0342f85 100755
--- a/res/values/cm_colors.xml
+++ b/res/values/cm_colors.xml
@@ -56,9 +56,4 @@
<color name="snack_bar_action_text_color">#EEFF41</color>
<color name="mic_recording_color">#ffffff</color>
<color name="mic_background_color">#ffffff</color>
-
- <!-- Ridesharing -->
- <color name="transparent_gray">#1F000000</color>
- <color name="white_54">#8BFFFFFF</color>
- <color name="black_54">#8B000000</color>
</resources>
diff --git a/res/values/cm_dimens.xml b/res/values/cm_dimens.xml
index f367e0c..2dc13c2 100644
--- a/res/values/cm_dimens.xml
+++ b/res/values/cm_dimens.xml
@@ -19,23 +19,4 @@
<dimen name="convolist_attribution_logo_marginRight">13dp</dimen>
<dimen name="convo_attribution_logo_marginRight">5dp</dimen>
<dimen name="convo_attribution_logo_marginBottom">5dp</dimen>
-
- <!-- Ride sharing -->
- <dimen name="conversation_maps_width">221dp</dimen>
- <dimen name="conversation_maps_height">144dp</dimen>
- <dimen name="conversation_maps_margin">8dp</dimen>
- <dimen name="maps_button_elevation">2dp</dimen>
- <dimen name="maps_button_width">205dp</dimen>
- <dimen name="maps_button_height">32dp</dimen>
- <dimen name="request_ride_button_width">172dp</dimen>
- <dimen name="request_ride_text_size">12sp</dimen>
- <dimen name="brand_image_width">18dp</dimen>
- <dimen name="brand_image_height">18dp</dimen>
- <dimen name="brand_image_margin">7dp</dimen>
- <dimen name="directions_button_width">32dp</dimen>
- <dimen name="directions_button_padding">4dp</dimen>
- <dimen name="maps_button_divider_width">1dp</dimen>
- <dimen name="maps_error_icon_width">1dp</dimen>
- <dimen name="maps_error_icon_height">1dp</dimen>
- <dimen name="maps_corner_radius">3dp</dimen>
</resources>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index e48c45c..4d6d424 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -155,7 +155,4 @@
<string name="mediapicker_audio_list_item_selected_content_description">The audio is selected.</string>
<string name="mediapicker_audio_list_item_unselected_content_description">The audio is unselected.</string>
<string name="mediapicker_audio_list_title_selection"><xliff:g id="count">%d</xliff:g> selected</string>
-
- <!-- Ride sharing -->
- <string name="request_ride">Request Ride</string>
</resources>
diff --git a/res/values/google_maps_api.xml b/res/values/google_maps_api.xml
deleted file mode 100644
index f165a09..0000000
--- a/res/values/google_maps_api.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<resources>
- <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"></string>
-</resources>
diff --git a/src/com/android/messaging/ui/AsyncImageView.java b/src/com/android/messaging/ui/AsyncImageView.java
index f2394d0..e18d677 100644
--- a/src/com/android/messaging/ui/AsyncImageView.java
+++ b/src/com/android/messaging/ui/AsyncImageView.java
@@ -113,6 +113,8 @@ public class AsyncImageView extends ImageView implements MediaResourceLoadListen
attr.recycle();
}
+
+
/**
* The main entrypoint for AsyncImageView to load image resource given an ImageRequestDescriptor
* @param descriptor the request descriptor, or null if no image should be displayed
diff --git a/src/com/android/messaging/ui/conversation/ConversationMessageAdapter.java b/src/com/android/messaging/ui/conversation/ConversationMessageAdapter.java
index f740f39..3d50252 100644
--- a/src/com/android/messaging/ui/conversation/ConversationMessageAdapter.java
+++ b/src/com/android/messaging/ui/conversation/ConversationMessageAdapter.java
@@ -28,7 +28,6 @@ import com.android.messaging.ui.CursorRecyclerAdapter;
import com.android.messaging.ui.AsyncImageView.AsyncImageViewDelayLoader;
import com.android.messaging.ui.conversation.ConversationMessageView.ConversationMessageViewHost;
import com.android.messaging.util.Assert;
-import com.cyanogenmod.messaging.util.RidesharingUtil;
import java.util.HashSet;
import java.util.List;
@@ -41,7 +40,6 @@ public class ConversationMessageAdapter extends
CursorRecyclerAdapter<ConversationMessageAdapter.ConversationMessageViewHolder> {
private final ConversationMessageViewHost mHost;
- private final RidesharingUtil mRidesharingUtil;
private final AsyncImageViewDelayLoader mImageViewDelayLoader;
private final View.OnClickListener mViewClickListener;
private final View.OnLongClickListener mViewLongClickListener;
@@ -56,7 +54,6 @@ public class ConversationMessageAdapter extends
final View.OnLongClickListener longClickListener) {
super(context, cursor, 0);
mHost = host;
- mRidesharingUtil = new RidesharingUtil(context);
mViewClickListener = viewClickListener;
mViewLongClickListener = longClickListener;
mImageViewDelayLoader = imageViewDelayLoader;
@@ -94,7 +91,6 @@ public class ConversationMessageAdapter extends
final ConversationMessageView conversationMessageView = (ConversationMessageView)
layoutInflater.inflate(R.layout.conversation_message_view, null);
conversationMessageView.setHost(mHost);
- conversationMessageView.setRidesharingUtil(mRidesharingUtil);
conversationMessageView.setImageViewDelayLoader(mImageViewDelayLoader);
return new ConversationMessageViewHolder(conversationMessageView,
mViewClickListener, mViewLongClickListener);
diff --git a/src/com/android/messaging/ui/conversation/ConversationMessageView.java b/src/com/android/messaging/ui/conversation/ConversationMessageView.java
index fae36c3..22128bc 100644
--- a/src/com/android/messaging/ui/conversation/ConversationMessageView.java
+++ b/src/com/android/messaging/ui/conversation/ConversationMessageView.java
@@ -17,7 +17,6 @@
package com.android.messaging.ui.conversation;
import android.content.Context;
-import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Rect;
@@ -32,19 +31,15 @@ import android.text.style.URLSpan;
import android.text.util.Linkify;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
-import android.widget.Button;
import android.widget.FrameLayout;
-import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.messaging.BugleApplication;
@@ -78,19 +73,11 @@ import com.android.messaging.util.OsUtil;
import com.android.messaging.util.PhoneUtils;
import com.android.messaging.util.UiUtils;
import com.android.messaging.util.YouTubeUtil;
-import com.cyanogen.ambient.ridesharing.core.RidesharingContract;
import com.cyanogen.lookup.phonenumber.response.LookupResponse;
import com.cyanogenmod.messaging.lookup.LookupProviderManager.LookupProviderListener;
import com.cyanogenmod.messaging.ui.AttributionContactIconView;
-import com.cyanogenmod.messaging.util.GoogleStaticMapsUtil;
-import com.cyanogenmod.messaging.util.RidesharingUtil;
-import com.cyanogenmod.messaging.util.RoundedCornerTransformation;
import com.google.common.base.Predicate;
-import com.squareup.picasso.*;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -108,22 +95,13 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
boolean excludeDefault);
}
- private static final String TAG = ConversationMessageView.class.getSimpleName();
-
private final ConversationMessageData mData;
private LinearLayout mMessageAttachmentsView;
private MultiAttachmentLayout mMultiAttachmentView;
private AsyncImageView mMessageImageView;
- private RelativeLayout mMessageMapsView;
- private ImageView mMessageMapsImageView;
- private Button mRequestRideButton;
- private ImageView mBrandImageView;
- private ImageView mDirectionsButton;
- private View mButtonDivider;
private TextView mMessageTextView;
private boolean mMessageTextHasLinks;
- private boolean mMessageHasMapsLink;
private boolean mMessageHasYouTubeLink;
private TextView mStatusTextView;
private TextView mTitleTextView;
@@ -142,13 +120,11 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
private boolean mOneOnOne;
private ConversationMessageViewHost mHost;
- private RidesharingUtil mRidesharingUtil;
public ConversationMessageView(final Context context, final AttributeSet attrs) {
super(context, attrs);
// TODO: we should switch to using Binding and DataModel factory methods.
mData = new ConversationMessageData();
- mRidesharingUtil = new RidesharingUtil(context);
}
@Override
@@ -170,13 +146,6 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
mMessageImageView.setOnClickListener(this);
mMessageImageView.setOnLongClickListener(this);
- mMessageMapsView = (RelativeLayout) findViewById(R.id.message_maps);
- mMessageMapsImageView = (ImageView) findViewById(R.id.maps_image);
- mRequestRideButton = (Button) findViewById(R.id.request_ride_button);
- mBrandImageView = (ImageView) findViewById(R.id.brand_image);
- mDirectionsButton= (ImageView) findViewById(R.id.directions_button);
- mButtonDivider = findViewById(R.id.button_divider);
-
mMessageTextView = (TextView) findViewById(R.id.message_text);
mMessageTextView.setOnClickListener(this);
IgnoreLinkLongClickHelper.ignoreLinkLongClick(mMessageTextView, this);
@@ -319,13 +288,6 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
}
/**
- * Sets a ridesharing util to get data from ridesharing services
- */
- public void setRidesharingUtil(final RidesharingUtil ridesharingUtil) {
- mRidesharingUtil = ridesharingUtil;
- }
-
- /**
* Sets a delay loader instance to manage loading / resuming of image attachments.
*/
public void setImageViewDelayLoader(final AsyncImageViewDelayLoader delayLoader) {
@@ -352,7 +314,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
*/
private boolean shouldShowMessageBubbleArrow() {
return !shouldShowSimplifiedVisualStyle()
- && !(mData.hasAttachments() || mMessageHasMapsLink || mMessageHasYouTubeLink);
+ && !(mData.hasAttachments() || mMessageHasYouTubeLink);
}
/**
@@ -581,11 +543,6 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
mMultiAttachmentView.setVisibility(View.GONE);
}
- // In the case that we have no image attachments and a maps url then we will show a map
- // preview
- String mapsUrlString = null;
- final String mapsUrlPrefix = "geo:0,0?q=";
-
// In the case that we have no image attachments and exactly one youtube link in a message
// then we will show a preview.
String youtubeThumbnailUrl = null;
@@ -596,35 +553,28 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
messageTextWithSpans.length(), URLSpan.class);
for (URLSpan span : spans) {
String url = span.getURL();
- if (url.startsWith(mapsUrlPrefix)) {
- mapsUrlString = url;
- break;
- } else {
- String youtubeLinkForUrl = YouTubeUtil.getYoutubePreviewImageLink(url);
- if (!TextUtils.isEmpty(youtubeLinkForUrl)) {
- if (TextUtils.isEmpty(youtubeThumbnailUrl)) {
- // Save the youtube link if we don't already have one
- youtubeThumbnailUrl = youtubeLinkForUrl;
- originalYoutubeLink = url;
- } else {
- // We already have a youtube link. This means we have two youtube links so
- // we shall show none.
- youtubeThumbnailUrl = null;
- originalYoutubeLink = null;
- break;
- }
+ String youtubeLinkForUrl = YouTubeUtil.getYoutubePreviewImageLink(url);
+ if (!TextUtils.isEmpty(youtubeLinkForUrl)) {
+ if (TextUtils.isEmpty(youtubeThumbnailUrl)) {
+ // Save the youtube link if we don't already have one
+ youtubeThumbnailUrl = youtubeLinkForUrl;
+ originalYoutubeLink = url;
+ } else {
+ // We already have a youtube link. This means we have two youtube links so
+ // we shall show none.
+ youtubeThumbnailUrl = null;
+ originalYoutubeLink = null;
+ break;
}
}
}
}
// We need to keep track if we have a youtube link in the message so that we will not show
// the arrow
- mMessageHasMapsLink = !TextUtils.isEmpty(mapsUrlString);
mMessageHasYouTubeLink = !TextUtils.isEmpty(youtubeThumbnailUrl);
- // We will show the message image view if there is one attachment or one maps link or
- // one youtube link
- if (imageParts.size() == 1 || mMessageHasMapsLink || mMessageHasYouTubeLink) {
+ // We will show the message image view if there is one attachment or one youtube link
+ if (imageParts.size() == 1 || mMessageHasYouTubeLink) {
// Get the display metrics for a hint for how large to pull the image data into
final WindowManager windowManager = (WindowManager) getContext().
getSystemService(Context.WINDOW_SERVICE);
@@ -647,10 +597,6 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
adjustImageViewBounds(imagePart);
mMessageImageView.setImageResourceId(imageRequest);
mMessageImageView.setTag(imagePart);
- mMessageImageView.setVisibility(View.VISIBLE);
- } else if (mMessageHasMapsLink) {
- // Maps image and buttons
- showMapsPreview(mapsUrlString, mapsUrlPrefix, desiredWidth);
} else {
// Youtube Thumbnail image
final ImageRequestDescriptor imageRequest =
@@ -661,11 +607,9 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
ImageUtils.DEFAULT_CIRCLE_STROKE_COLOR /* circleStrokeColor */);
mMessageImageView.setImageResourceId(imageRequest);
mMessageImageView.setTag(originalYoutubeLink);
- mMessageImageView.setVisibility(View.VISIBLE);
}
+ mMessageImageView.setVisibility(View.VISIBLE);
} else {
- mMessageMapsView.setVisibility(View.GONE);
-
mMessageImageView.setImageResourceId(null);
mMessageImageView.setVisibility(View.GONE);
}
@@ -682,103 +626,6 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
mMessageAttachmentsView.setVisibility(attachmentsVisible ? View.VISIBLE : View.GONE);
}
- /**
- * Shows a maps preview and provides buttons for requesting a ride to the location and
- * directions to the location
- * @param mapsUrlString Encoded map url string
- * @param mapsUrlPrefix Prefix for the map url string (such as geo:0,0?q=)
- * @param desiredWidth Desired width of the maps preview
- */
- private void showMapsPreview(String mapsUrlString, String mapsUrlPrefix, int desiredWidth) {
- final int unspecifiedMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
- final int mapsMeasureSpec = MeasureSpec.makeMeasureSpec(desiredWidth,
- MeasureSpec.EXACTLY);
- mMessageMapsView.measure(mapsMeasureSpec, unspecifiedMeasureSpec);
-
- // Reset view visibility to gone
- mRequestRideButton.setVisibility(View.GONE);
- mBrandImageView.setVisibility(View.GONE);
- mDirectionsButton.setVisibility(View.GONE);
- mButtonDivider.setVisibility(View.GONE);
-
- final String encodedAddress = mapsUrlString.substring(mapsUrlPrefix.length());
- final int height = getResources()
- .getDimensionPixelSize(R.dimen.conversation_maps_height);
- String staticMapsUrl = GoogleStaticMapsUtil.getStaticMapsUrl(mContext, desiredWidth,
- height, encodedAddress);
- RoundedCornerTransformation transformation =
- new RoundedCornerTransformation(mContext.getApplicationContext(), staticMapsUrl);
- Picasso.with(mContext.getApplicationContext())
- .load(staticMapsUrl)
- .placeholder(R.drawable.ic_map_placeholder)
- .transform(transformation)
- .into(mMessageMapsImageView, new ImageLoadedCallback());
- final Uri mapsUri = Uri.parse(mapsUrlString);
- mMessageMapsImageView.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Intent.ACTION_VIEW, mapsUri);
- mContext.startActivity(intent);
- }
- });
-
- final String directionsPrefix = "google.navigation:q=";
- final Uri directionsUri = Uri.parse(directionsPrefix + encodedAddress);
- mDirectionsButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(Intent.ACTION_VIEW, directionsUri);
- mContext.startActivity(intent);
- }
- });
-
- final String encodingFormat = "UTF-8";
- mRequestRideButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- String decodedAddress = null;
- try {
- decodedAddress = URLDecoder.decode(encodedAddress, encodingFormat);
- } catch (UnsupportedEncodingException e) {
- Log.e(TAG, "Unable to decode address: " + encodedAddress, e);
- }
-
- if (!TextUtils.isEmpty(decodedAddress)) {
- RidesharingContract.RideRequest.Builder builder =
- new RidesharingContract.RideRequest.Builder();
- builder.addDropoffLocation(decodedAddress);
- Intent intent = builder.build();
- mContext.startActivity(intent);
- }
- }
- });
-
- mRidesharingUtil.setBrandBitmap(mBrandImageView);
-
- final int dividerWidth = getResources()
- .getDimensionPixelSize(R.dimen.maps_button_divider_width);
- final int dividerWidthMeasureSpec = MeasureSpec.makeMeasureSpec(dividerWidth,
- MeasureSpec.EXACTLY);
- mButtonDivider.measure(dividerWidthMeasureSpec, unspecifiedMeasureSpec);
-
- mMessageMapsView.setVisibility(View.VISIBLE);
- }
-
- private class ImageLoadedCallback implements com.squareup.picasso.Callback {
- @Override
- public void onSuccess() {
- mRequestRideButton.setVisibility(View.VISIBLE);
- mBrandImageView.setVisibility(View.VISIBLE);
- mDirectionsButton.setVisibility(View.VISIBLE);
- mButtonDivider.setVisibility(View.VISIBLE);
- }
-
- @Override
- public void onError() {
- Log.e(TAG, "Unable to load static map");
- }
- }
-
private void bindAttachmentsOfSameType(final Predicate<MessagePartData> attachmentTypeFilter,
final int attachmentViewLayoutRes, final AttachmentViewBinder viewBinder,
final Class<?> attachmentViewClass) {
@@ -1038,16 +885,6 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
// Tint image/video attachments when selected
final int selectedImageTint = getResources().getColor(R.color.message_image_selected_tint);
- if (mMessageMapsImageView.getVisibility() == View.VISIBLE &&
- mDirectionsButton.getVisibility() == View.VISIBLE) {
- if (isSelected()) {
- mMessageMapsImageView.setColorFilter(selectedImageTint);
- mDirectionsButton.setColorFilter(selectedImageTint);
- } else {
- mMessageMapsImageView.clearColorFilter();
- mDirectionsButton.clearColorFilter();
- }
- }
if (mMessageImageView.getVisibility() == View.VISIBLE) {
if (isSelected()) {
mMessageImageView.setColorFilter(selectedImageTint);
@@ -1427,4 +1264,5 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
}
}
}
+
}
diff --git a/src/com/cyanogenmod/messaging/util/GoogleStaticMapsUtil.java b/src/com/cyanogenmod/messaging/util/GoogleStaticMapsUtil.java
deleted file mode 100644
index a88dfb0..0000000
--- a/src/com/cyanogenmod/messaging/util/GoogleStaticMapsUtil.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2016 The CyanogenMod 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.
- */
-
-package com.cyanogenmod.messaging.util;
-
-import android.content.Context;
-import com.android.messaging.R;
-
-public class GoogleStaticMapsUtil {
- private static final String STATIC_MAPS_URL = "https://maps.googleapis.com/maps/api/staticmap?";
-
- private static final String AND = "&";
- private static final String PIPE = "|";
- private static final String X = "x";
-
- private static final String SIZE = "size=";
- private static final String ZOOM = "zoom=18";
- private static final String SCALE = "scale=4";
- private static final String API_KEY = "key=";
-
- private static final String PICK_UP_MARKER =
- "markers=icon:http://cdn.cyngn.com/ridesharing/pickup_marker.png";
-
- public static String getStaticMapsUrl(Context context, int width, int height, String encodedAddress) {
- final StringBuilder sb = new StringBuilder(STATIC_MAPS_URL);
- sb.append(AND);
- sb.append(SIZE);
- sb.append(width);
- sb.append(X);
- sb.append(height);
- sb.append(AND);
- sb.append(ZOOM);
- sb.append(AND);
- sb.append(SCALE);
- sb.append(AND);
- sb.append(API_KEY);
- sb.append(context.getString(R.string.google_maps_key));
- sb.append(AND);
- sb.append(PICK_UP_MARKER);
- sb.append(PIPE);
- sb.append(encodedAddress);
-
- return sb.toString();
- }
-}
diff --git a/src/com/cyanogenmod/messaging/util/RidesharingUtil.java b/src/com/cyanogenmod/messaging/util/RidesharingUtil.java
deleted file mode 100644
index 5c2ef05..0000000
--- a/src/com/cyanogenmod/messaging/util/RidesharingUtil.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.cyanogenmod.messaging.util;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.ImageView;
-import com.cyanogen.ambient.common.ConnectionResult;
-import com.cyanogen.ambient.common.api.AmbientApiClient;
-import com.cyanogen.ambient.common.api.ComponentNameResult;
-import com.cyanogen.ambient.common.api.PendingResult;
-import com.cyanogen.ambient.common.api.ResultCallback;
-import com.cyanogen.ambient.ridesharing.RideSharingApi;
-import com.cyanogen.ambient.ridesharing.RideSharingServices;
-import com.cyanogen.ambient.ridesharing.results.ProviderInfoResult;
-
-/**
- * Ridesharing services util
- */
-public class RidesharingUtil {
- private static final String TAG = RidesharingUtil.class.getSimpleName();
-
- private Context mContext;
- private AmbientApiClient mAmbientApiClient;
- private RideSharingApi mRideSharingApi;
-
- private Bitmap mBrandBitmap;
-
- public RidesharingUtil(Context context) {
- mContext = context;
- connectAmbientApiClientIfNeeded();
- }
-
- /**
- * Sets brand bitmap from the active ridesharing provider to the specified {@link ImageView}
- * @param imageView ImageView to set the brand bitmap on
- */
- public void setBrandBitmap(final ImageView imageView) {
- if (mBrandBitmap == null) {
- connectAmbientApiClientIfNeeded();
-
- PendingResult<ComponentNameResult> pendingComponentResult =
- mRideSharingApi.getActivePlugin(mAmbientApiClient);
- pendingComponentResult.setResultCallback(new ResultCallback<ComponentNameResult>() {
- @Override
- public void onResult(final ComponentNameResult componentResult) {
- if (componentResult != null && componentResult.component != null) {
- PendingResult<ProviderInfoResult> pendingInfoResult =
- mRideSharingApi.getPluginInfo(mAmbientApiClient,
- componentResult.component);
- pendingInfoResult.setResultCallback(new ResultCallback<ProviderInfoResult>() {
- @Override
- public void onResult(ProviderInfoResult infoResult) {
- if (infoResult != null && infoResult.providerInfo != null) {
- mBrandBitmap = infoResult.providerInfo.getBrandIcon();
- imageView.setImageBitmap(mBrandBitmap);
- } else {
- Log.e(TAG, "Unable to get provider info for active plugin: "
- + componentResult.component);
- }
- }
- });
- } else {
- Log.e(TAG, "Unable to get active plugin");
- }
- }
- });
- } else {
- imageView.setImageBitmap(mBrandBitmap);
- }
- }
-
- /**
- * Helper method to initialize AmbientApiClient if it is null and connect AmbientApiClient if
- * it is not connected and not currently trying to connect
- */
- private void connectAmbientApiClientIfNeeded() {
- if (mAmbientApiClient == null) {
- Log.d(TAG, "mAmbientApiClient is null, initializing");
- mAmbientApiClient = new AmbientApiClient.Builder(mContext)
- .addApi(RideSharingServices.API)
- .build();
- if (mAmbientApiClient == null) {
- Log.e(TAG, "AmbientApiClient couldn't initialize, returning");
- return;
- }
- mAmbientApiClient.registerConnectionFailedListener(new AmbientApiClient.OnConnectionFailedListener() {
- @Override
- public void onConnectionFailed(ConnectionResult connectionResult) {
- Log.e(TAG, "Unable to connect with Ambient. ConnectionResult.ErrorCode : " + connectionResult.getErrorCode());
- }
- });
- mAmbientApiClient.registerConnectionCallbacks(new AmbientApiClient.ConnectionCallbacks() {
- @Override
- public void onConnected(Bundle bundle) {
- Log.d(TAG, "Connected with Ambient.");
- }
-
- @Override
- public void onConnectionSuspended(int i) {
- Log.d(TAG, "Ambient client disconnected.");
- }
- });
- }
-
- if (!mAmbientApiClient.isConnected() && !mAmbientApiClient.isConnecting()) {
- Log.d(TAG, "ambientApiClient is not connect or connecting, attempting to connect now");
- mAmbientApiClient.connect();
- mRideSharingApi = RideSharingServices.getInstance();
- }
- }
-}
diff --git a/src/com/cyanogenmod/messaging/util/RoundedCornerTransformation.java b/src/com/cyanogenmod/messaging/util/RoundedCornerTransformation.java
deleted file mode 100644
index 197a774..0000000
--- a/src/com/cyanogenmod/messaging/util/RoundedCornerTransformation.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.cyanogenmod.messaging.util;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapShader;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.RectF;
-import android.graphics.Shader;
-import android.support.v7.appcompat.R;
-
-public class RoundedCornerTransformation implements com.squareup.picasso.Transformation {
- private Context mContext;
- private String mTag;
-
- public RoundedCornerTransformation(Context context, String tag) {
- mContext = context;
- mTag = tag;
- }
-
- @Override
- public Bitmap transform(Bitmap source) {
- int width = source.getWidth();
- int height = source.getHeight();
-
- Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- final RectF rect = new RectF(0, 0, width, height);
-
- final int radius =
- mContext.getResources().getDimensionPixelSize(R.dimen.maps_corner_radius);
- Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
- BitmapShader shader = new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
- paint.setShader(shader);
- canvas.drawRoundRect(rect, radius, radius, paint);
-
- source.recycle();
-
- return bitmap;
- }
-
- @Override
- public String key() {
- return mTag;
- }
-}