|
|
@@ -3,15 +3,22 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.view.screen.main;
|
|
|
|
|
|
+import android.animation.Animator;
|
|
|
+import android.animation.ObjectAnimator;
|
|
|
import android.content.Context;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.util.Log;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.view.animation.Animation;
|
|
|
+import android.view.animation.LinearInterpolator;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.TextView;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.MainContentsBean;
|
|
|
import kr.co.zumo.app.lifeplus.model.SuperModel;
|
|
|
+import kr.co.zumo.app.lifeplus.supervisor.AnimatorManager;
|
|
|
import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.IEventListener;
|
|
|
@@ -67,9 +74,19 @@ public class MainContentsWeatherHolder extends MainContentsHolder /*implements V
|
|
|
private float initWeatherY;
|
|
|
private ViewGroup weather;
|
|
|
|
|
|
+ private TextView textTopView;
|
|
|
+ private TextView textBottomView;
|
|
|
+ private ImageView weahterView;
|
|
|
+ private ViewGroup layoutWeatherBottom;
|
|
|
+
|
|
|
@Override
|
|
|
public void init(int index, MainContentsBean bean, IEventListener listener) {
|
|
|
weather = itemView.findViewById(R.id.layout_container_weather);
|
|
|
+ textTopView = itemView.findViewById(R.id.text_weather_top);
|
|
|
+ textBottomView = itemView.findViewById(R.id.text_weather_bottom);
|
|
|
+ weahterView = itemView.findViewById(R.id.icon_weather);
|
|
|
+ layoutWeatherBottom = itemView.findViewById(R.id.layout_weather_bottom);
|
|
|
+
|
|
|
int statusBarHeight = ResourceUtil.getStatusBarHeightManual();
|
|
|
|
|
|
// 첫 번째 카테고리 내용이 약간 가려지도록 일정 높이를 조절한다.
|
|
|
@@ -82,6 +99,72 @@ public class MainContentsWeatherHolder extends MainContentsHolder /*implements V
|
|
|
initY = 0; //itemView.getY(); //getScreenY(itemView);
|
|
|
weather.setOnClickListener(view -> {listener.onEvent(new Event.Builder(Event.CLICK).build());});
|
|
|
Log.i("APP# MainContentsWeatherHolder | init", "|" + " initY: " + initY + " initWeatherY: " + initWeatherY + ", this: " + this);
|
|
|
+
|
|
|
+ animate();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void animate() {
|
|
|
+// Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
|
|
|
+// Keyframe kf1 = Keyframe.ofFloat(.5f, 360f);
|
|
|
+// Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
|
|
|
+// PropertyValuesHolder pvhRotation = PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
|
|
|
+// ObjectAnimator rotationAnim = ObjectAnimator.ofPropertyValuesHolder(weahterView, pvhRotation);
|
|
|
+ ObjectAnimator rotationAnim = ObjectAnimator.ofFloat(weahterView, "rotation", 0f, 360f);
|
|
|
+ rotationAnim.setDuration(17000);
|
|
|
+ rotationAnim.setInterpolator(new LinearInterpolator());
|
|
|
+ rotationAnim.setRepeatCount(Animation.INFINITE);
|
|
|
+
|
|
|
+ rotationAnim.start();
|
|
|
+
|
|
|
+ if (AnimatorManager.getInstance().isCompleted() == false) {
|
|
|
+ weahterView.setTranslationY(100f);
|
|
|
+ ObjectAnimator weatherAnimator = ObjectAnimator.ofFloat(weahterView, "translationY", 0f);
|
|
|
+ weatherAnimator.setDuration(500);
|
|
|
+ weatherAnimator.addListener(new AnimatorManager.SimpleListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animation) {
|
|
|
+ weahterView.setTranslationY(0f);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ weahterView.setAlpha(0f);
|
|
|
+ ObjectAnimator weatherAlphaAnimator = ObjectAnimator.ofFloat(weahterView, "alpha", 1f);
|
|
|
+ weatherAlphaAnimator.setDuration(800);
|
|
|
+ weatherAlphaAnimator.addListener(new AnimatorManager.SimpleListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animation) {
|
|
|
+ weahterView.setAlpha(1f);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ AnimatorManager.getInstance().add(weatherAlphaAnimator);
|
|
|
+ AnimatorManager.getInstance().add(weatherAnimator);
|
|
|
+
|
|
|
+ textTopView.setTranslationY(100f);
|
|
|
+ ObjectAnimator textTopAnimator = ObjectAnimator.ofFloat(textTopView, "translationY", 0f);
|
|
|
+ textTopAnimator.setStartDelay(500);
|
|
|
+ textTopAnimator.setDuration(500);
|
|
|
+ textTopAnimator.addListener(new AnimatorManager.SimpleListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animation) {
|
|
|
+ textTopView.setTranslationY(0f);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ layoutWeatherBottom.setTranslationY(100f);
|
|
|
+ ObjectAnimator textBottomAnimator = ObjectAnimator.ofFloat(layoutWeatherBottom, "translationY", 0f);
|
|
|
+ textBottomAnimator.setStartDelay(700);
|
|
|
+ textBottomAnimator.setDuration(500);
|
|
|
+ textTopAnimator.addListener(new AnimatorManager.SimpleListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animation) {
|
|
|
+ layoutWeatherBottom.setTranslationY(0f);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ AnimatorManager.getInstance().add(textTopAnimator);
|
|
|
+ AnimatorManager.getInstance().add(textBottomAnimator);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|