소스 검색

[이벤트][Common] 차트, 나의 pick 플래그 애니메이션 적용

Hasemi 6 년 전
부모
커밋
6f13fe2976

+ 29 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/event/EventChartViewHolder.java

@@ -29,6 +29,7 @@ public class EventChartViewHolder extends RecyclerView.ViewHolder {
   private View viewGraph;
   private TextView textViewItemTitle;
   private TextView textViewTotalCount;
+  private float randomGraph = (float) (Math.random() * 150 + 1);
 
 
   public EventChartViewHolder(View itemView) {
@@ -42,7 +43,6 @@ public class EventChartViewHolder extends RecyclerView.ViewHolder {
 
   public void bind(IEventListener listener) {
     // TODO: 그래프 계산
-    float randomGraph = (float) (Math.random() * 150 + 1);
     imageViewBackGround.setBackgroundColor(itemView.getResources().getColor(R.color.CF6F6F6));
     textViewItemTitle.setText("연남동");
     textViewTotalCount.setText((int) randomGraph + "명");
@@ -56,9 +56,34 @@ public class EventChartViewHolder extends RecyclerView.ViewHolder {
   }
 
   public void doStartAnimation() {
-    ScaleAnimation animation
+    ScaleAnimation graphAnimation
       = new ScaleAnimation(1.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1.0f);
-    animation.setDuration(1200);
-    viewGraph.startAnimation(animation);
+    graphAnimation.setDuration(1200);
+    viewGraph.startAnimation(graphAnimation);
+
+    ScaleAnimation userFlagAnimation
+      = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
+    userFlagAnimation.setDuration(500);
+
+    graphAnimation.setAnimationListener(new Animation.AnimationListener() {
+      @Override
+      public void onAnimationStart(Animation animation) {
+
+      }
+
+      @Override
+      public void onAnimationEnd(Animation animation) {
+
+        if (randomGraph > 100) {
+          flagUserPick.setVisibility(View.VISIBLE);
+          flagUserPick.startAnimation(userFlagAnimation);
+        }
+      }
+
+      @Override
+      public void onAnimationRepeat(Animation animation) {
+
+      }
+    });
   }
 }

+ 1 - 2
app/src/main/res/layout/event_chart_view_item.xml

@@ -45,14 +45,13 @@
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:lineSpacingExtra="4sp"
+      android:text="@string/my_pick"
       android:textColor="@color/CFFFFFF"
       android:textSize="9sp"
       app:layout_constraintBottom_toBottomOf="@+id/view_circle"
       app:layout_constraintEnd_toEndOf="@+id/view_circle"
       app:layout_constraintStart_toStartOf="@+id/view_circle"
       app:layout_constraintTop_toTopOf="@+id/view_circle"
-      tools:text="나의
-Pick"
       />
   </android.support.constraint.ConstraintLayout>
 

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -830,5 +830,7 @@
   <string name="evet_participation">이벤트 참여하기</string>
   <string name="contents_recommend_comment">이런 콘텐츠는 어떠세요?</string>
 
+  <string name="my_pick">나의\nPick</string>
+
   <!-- 임의 추가 문자열 : 끝 -->
 </resources>