Add fade out animation in marker detail view

This commit is contained in:
Jimmy Shih
2013-11-04 13:39:48 -08:00
parent 48ad505e55
commit 5867093895
2 changed files with 42 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013 Google Inc.
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.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="2000"
android:fromAlpha="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="0.0" />
@@ -43,6 +43,9 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -77,8 +80,23 @@ public class MarkerDetailFragment extends Fragment {
private Runnable hideText = new Runnable() {
@Override
public void run() {
textGradient.setVisibility(View.GONE);
waypointInfo.setVisibility(View.GONE);
Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.fadeout);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation anim) {}
@Override
public void onAnimationRepeat(Animation anim) {}
@Override
public void onAnimationEnd(Animation anim) {
textGradient.setVisibility(View.GONE);
waypointInfo.setVisibility(View.GONE);
}
});
textGradient.startAnimation(animation);
waypointInfo.startAnimation(animation);
}
};
@@ -222,6 +240,7 @@ public class MarkerDetailFragment extends Fragment {
textGradient.setVisibility(View.GONE);
waypointInfo.setVisibility(View.VISIBLE);
} else {
handler.removeCallbacks(hideText);
photo.setVisibility(View.VISIBLE);
textGradient.setVisibility(View.VISIBLE);
waypointInfo.setVisibility(View.VISIBLE);