Bladeren bron

Merge branch 'develop' of https://github.com/swict/LifeplusAndroid into develop

# Conflicts:
#	app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/search/SearchResultFragment.java
hyodong.min 7 jaren geleden
bovenliggende
commit
6fe26fce48

+ 40 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/search/SearchResultFragment.java

@@ -7,11 +7,14 @@ import android.graphics.Rect;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
+import android.support.constraint.ConstraintLayout;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.Transformation;
 
 import java.util.List;
 
@@ -83,8 +86,15 @@ public class SearchResultFragment extends FragmentBase<SearchResultPresenter> im
       }
     });
 
+
     recyclerViewResultContents = findViewById(R.id.recycler_view_search_result);
     recyclerViewResultContents.setLayoutManager(new LinearLayoutManager(getContext()));
+    recyclerViewResultContents.addOnScrollListener(new RecyclerView.OnScrollListener() {
+      @Override
+      public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+        startAnimation(dy);
+      }
+    });
 
     imageFilter = findViewById(R.id.image_filter);
     imageFilter.setOnClickListener(v -> {
@@ -164,4 +174,34 @@ public class SearchResultFragment extends FragmentBase<SearchResultPresenter> im
     }
   }
 
+  private void startAnimation(int dy) {
+
+    if (dy > 20) {
+      Animation animation = new Animation() {
+        @Override
+        protected void applyTransformation(float interpolatedTime, Transformation t) {
+          ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) containerCategory.getLayoutParams();
+          layoutParams.topMargin = 0;
+          containerCategory.setLayoutParams(layoutParams);
+        }
+      };
+
+      animation.setDuration(500);
+      containerCategory.startAnimation(animation);
+    }
+    else if (dy < -20) {
+      Animation animation = new Animation() {
+        @Override
+        protected void applyTransformation(float interpolatedTime, Transformation t) {
+          ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) containerCategory.getLayoutParams();
+          layoutParams.topMargin = ResourceUtil.dpToPx(9);
+          containerCategory.setLayoutParams(layoutParams);
+        }
+      };
+
+      animation.setDuration(500);
+      containerCategory.startAnimation(animation);
+    }
+
+  }
 }

+ 9 - 0
app/src/main/res/drawable/rectangle_cffffff_gradation.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+  <gradient
+    android:endColor="#ffffff"
+    android:centerColor="#00ffffff"
+    android:startColor="#00ffffff"
+    android:type="linear" />
+</shape>

+ 13 - 3
app/src/main/res/layout/fragment_search_result.xml

@@ -51,11 +51,11 @@
       app:layout_constraintTop_toTopOf="parent"/>
 
     <View
-      android:layout_width="80dp"
+      android:layout_width="28dp"
       android:layout_height="35dp"
-      android:background="@color/CFFFFFF"
+      android:background="@drawable/rectangle_cffffff_gradation"
       app:layout_constraintBottom_toBottomOf="parent"
-      app:layout_constraintEnd_toEndOf="parent"/>
+      app:layout_constraintEnd_toStartOf="@+id/image_filter"/>
 
     <ImageView
       android:id="@+id/image_filter"
@@ -64,15 +64,25 @@
       android:layout_marginEnd="17dp"
       android:padding="8dp"
       android:scaleType="center"
+      android:background="@color/CFFFFFF"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintEnd_toEndOf="parent"
       app:srcCompat="@drawable/ic_filter_de_copy_4"/>
+
+    <View
+      android:layout_width="18dp"
+      android:layout_height="35dp"
+      android:background="@color/CFFFFFF"
+      app:layout_constraintBottom_toBottomOf="parent"
+      app:layout_constraintStart_toEndOf="@+id/image_filter"
+      app:layout_constraintEnd_toEndOf="parent"/>
   </android.support.constraint.ConstraintLayout>
 
   <android.support.constraint.ConstraintLayout
     android:id="@+id/container_search_result"
     android:layout_width="match_parent"
     android:layout_height="0dp"
+    android:background="@color/CFFFFFF"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintTop_toBottomOf="@id/container_category">