Commit 07b303c6 authored by Varun Patil's avatar Varun Patil

fix(map): Zoom to location on search

parent d151d91d
...@@ -120,7 +120,8 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -120,7 +120,8 @@ public class MapFragment extends Fragment implements TextWatcher,
private final int MSG_ANIMATE = 1; private final int MSG_ANIMATE = 1;
private final int MSG_PLAY_SOUND = 2; private final int MSG_PLAY_SOUND = 2;
private final int MSG_DISPLAY_MAP = 3; private final int MSG_DISPLAY_MAP = 3;
private final long DELAY_ANIMATE = 50; private final long DELAY_ANIMATE = 300;
private final long DELAY_ANIMATE_SHORT = 50;
private final long DELAY_INIT_LAYOUT = 50; private final long DELAY_INIT_LAYOUT = 50;
public LinearLayout newSmallCard; public LinearLayout newSmallCard;
public ImageView placeColor; public ImageView placeColor;
...@@ -587,8 +588,9 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -587,8 +588,9 @@ public class MapFragment extends Fragment implements TextWatcher,
// display and zoom to marker if exists // display and zoom to marker if exists
if (marker != null) { if (marker != null) {
showCard(marker);
Message msg = mHandler.obtainMessage(MSG_ANIMATE, key); Message msg = mHandler.obtainMessage(MSG_ANIMATE, key);
mHandler.sendMessageDelayed(msg, DELAY_ANIMATE); mHandler.sendMessageDelayed(msg, cardSlideListener.isPanelOpen() ? DELAY_ANIMATE_SHORT : DELAY_ANIMATE);
} else { } else {
campusMapView.setResultMarker(null); campusMapView.setResultMarker(null);
this.dismissCard(); this.dismissCard();
...@@ -615,7 +617,6 @@ public class MapFragment extends Fragment implements TextWatcher, ...@@ -615,7 +617,6 @@ public class MapFragment extends Fragment implements TextWatcher,
getActivity().findViewById(R.id.place_group_color).setBackgroundColor( getActivity().findViewById(R.id.place_group_color).setBackgroundColor(
marker.getColor()); marker.getColor());
getActivity().findViewById(R.id.dragView).setVisibility(View.VISIBLE); getActivity().findViewById(R.id.dragView).setVisibility(View.VISIBLE);
reCenterMarker(marker);
cardSlideListener.showCard(); cardSlideListener.showCard();
} }
......
...@@ -109,6 +109,10 @@ public class CardSlideListener implements PanelSlideListener, ...@@ -109,6 +109,10 @@ public class CardSlideListener implements PanelSlideListener,
animator.start(); animator.start();
} }
public boolean isPanelOpen() {
return slidingLayout.getPanelHeight() > 10;
}
@Override @Override
public void onAnimationUpdate(ValueAnimator animator) { public void onAnimationUpdate(ValueAnimator animator) {
int panelHeight = (Integer) animator.getAnimatedValue(); int panelHeight = (Integer) animator.getAnimatedValue();
......
...@@ -309,9 +309,7 @@ public class CampusMapView extends SubsamplingScaleImageView { ...@@ -309,9 +309,7 @@ public class CampusMapView extends SubsamplingScaleImageView {
public void showResultMarker() { public void showResultMarker() {
if (resultMarker != null) { if (resultMarker != null) {
boolean noDelay = false; boolean noDelay = isInView(getResultMarker().getPoint());
if (isInView(getResultMarker().getPoint()))
noDelay = true;
AnimationBuilder anim = animateScaleAndCenter(getShowTextScale(), AnimationBuilder anim = animateScaleAndCenter(getShowTextScale(),
resultMarker.getPoint()); resultMarker.getPoint());
anim.withDuration(750).start(); anim.withDuration(750).start();
......
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
android:paddingRight="6dp" android:paddingRight="6dp"
android:paddingTop="3dp" android:paddingTop="3dp"
android:textColor="@color/primaryTextColor" android:textColor="@color/primaryTextColor"
android:textColorHint="@color/primaryTextColor" /> android:textColorHint="@color/primaryTextColor"
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionSearch" />
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment