|
|
@@ -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);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|