فهرست منبع

[이벤트][Common] 앱바레이아웃 관련 스크롤 변경

Hasemi 6 سال پیش
والد
کامیت
677390a91a

+ 19 - 22
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/recommend/EventRecommendTagFragment.java

@@ -29,7 +29,6 @@ import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
 import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
-import me.everything.android.ui.overscroll.OverScrollDecoratorHelper;
 
 /**
  * EventRecommendTagFragment
@@ -52,6 +51,7 @@ public class EventRecommendTagFragment extends FragmentBase<EventRecommendTagPre
   //  private LayoutInflater inflater;
 //  private HorizontalScrollView scrollTag;
   private EventRecommendTagAdapter adapter;
+  private LinearLayout layoutRecyclerViewContainer;
   private AppBarLayout appBarLayout;
 
 
@@ -69,12 +69,12 @@ public class EventRecommendTagFragment extends FragmentBase<EventRecommendTagPre
     layoutNothing = findViewById(R.id.layout_nothing);
     layoutTagContents = findViewById(R.id.layout_contents);
     ConstraintLayout layoutSelectBucket = findViewById(R.id.layout_select_bucket);
-   // scrollTag = findViewById(R.id.scroll_tag);
+    // scrollTag = findViewById(R.id.scroll_tag);
     recyclerViewEventList = findViewById(R.id.recycler_view_event_list_detail);
     layoutNothing = findViewById(R.id.layout_nothing);
     appBarLayout = findViewById(R.id.app_bar_layout);
     //inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
+    layoutRecyclerViewContainer = findViewById(R.id.layout_recycler_view_container);
     recyclerViewEventList.addItemDecoration(new RecyclerView.ItemDecoration() {
       @Override
       public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
@@ -84,7 +84,7 @@ public class EventRecommendTagFragment extends FragmentBase<EventRecommendTagPre
     });
     recyclerViewEventList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
     layoutSelectBucket.setPadding(0, ResourceUtil.getStatusBarHeightManual(), 0, 0);
-    OverScrollDecoratorHelper.setUpOverScroll(recyclerViewEventList, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
+    //.setUpOverScroll(recyclerViewEventList, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
   }
 
   @Override
@@ -184,11 +184,11 @@ public class EventRecommendTagFragment extends FragmentBase<EventRecommendTagPre
 
     if (isVisible) {
       layoutNothing.setVisibility(View.VISIBLE);
-      recyclerViewEventList.setVisibility(View.GONE);
+      layoutRecyclerViewContainer.setVisibility(View.GONE);
     }
     else {
       layoutNothing.setVisibility(View.GONE);
-      recyclerViewEventList.setVisibility(View.VISIBLE);
+      layoutRecyclerViewContainer.setVisibility(View.VISIBLE);
     }
   }
 
@@ -205,22 +205,19 @@ public class EventRecommendTagFragment extends FragmentBase<EventRecommendTagPre
   }
 
   private void addAppbarLayoutScrollChange() {
-    appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
-      @Override
-      public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
-        if (Math.abs(verticalOffset) > (appBarLayout.getTotalScrollRange() >> 1)) {
-          // 줄어든 상태
-          textViewEventTitle.setVisibility(View.GONE);
-          textViewSelectTitle.setTextColor(getResources().getColor(R.color.CFFFFFF));
-          textViewSelectTitle.setTextSize(15);
-        }
-        else {
-          // 커진 상태
-          textViewEventTitle.setVisibility(View.VISIBLE);
-          textViewSelectTitle.setVisibility(View.VISIBLE);
-          textViewSelectTitle.setTextColor(getResources().getColor(R.color.CC3C3C3));
-          textViewSelectTitle.setTextSize(14);
-        }
+    appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
+      if (Math.abs(verticalOffset) > (appBarLayout.getTotalScrollRange() >> 1)) {
+        // 줄어든 상태
+        textViewEventTitle.setVisibility(View.GONE);
+        textViewSelectTitle.setTextColor(getResources().getColor(R.color.CFFFFFF));
+        textViewSelectTitle.setTextSize(15);
+      }
+      else {
+        // 커진 상태
+        textViewEventTitle.setVisibility(View.VISIBLE);
+        textViewSelectTitle.setVisibility(View.VISIBLE);
+        textViewSelectTitle.setTextColor(getResources().getColor(R.color.CC3C3C3));
+        textViewSelectTitle.setTextSize(14);
       }
     });
   }

+ 22 - 27
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/bucketlist/BucketListWithTagDetailFragment.java

@@ -29,13 +29,11 @@ import kr.co.zumo.app.lifeplus.bean.api.LifeplusContentsBean;
 import kr.co.zumo.app.lifeplus.bean.api.TagBean;
 import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
 import kr.co.zumo.app.lifeplus.helper.ScreenSizeHelper;
-import kr.co.zumo.app.lifeplus.util.AppUtil;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
 import kr.co.zumo.app.lifeplus.view.IEventListener;
 import kr.co.zumo.app.lifeplus.view.custom.Tutorial;
 import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
-import me.everything.android.ui.overscroll.OverScrollDecoratorHelper;
 
 /**
  * BucketListWithTagDetailFragment
@@ -92,15 +90,16 @@ public class BucketListWithTagDetailFragment extends FragmentBase<BucketListWith
       appBarLayoutBehaviour.setDragCallback(new AppBarLayout.Behavior.DragCallback() {
         @Override
         public boolean canDrag(@NonNull AppBarLayout appBarLayout) {
-          boolean isReturn;
-
-          if (AppUtil.isDebug()) {
-            isReturn = true;
-          }
-          else {
-            isReturn = false;
-          }
-          return isReturn;
+//          boolean isReturn;
+//
+//          if (AppUtil.isDebug()) {
+//            isReturn = true;
+//          }
+//          else {
+//            isReturn = false;
+//          }
+//          return isReturn;
+          return false;
         }
       });
       layoutParams.setBehavior(appBarLayoutBehaviour);
@@ -183,7 +182,6 @@ public class BucketListWithTagDetailFragment extends FragmentBase<BucketListWith
         layoutTagContents.addView(view);
       }
 
-//      OverScrollDecoratorHelper.setUpStaticOverScroll(scrollTag, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);
     }
   }
 
@@ -211,7 +209,7 @@ public class BucketListWithTagDetailFragment extends FragmentBase<BucketListWith
         }
       });
       recyclerViewBucketListDetail.setAdapter(adapter);
-      OverScrollDecoratorHelper.setUpOverScroll(recyclerViewBucketListDetail, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
+      // OverScrollDecoratorHelper.setUpOverScroll(recyclerViewBucketListDetail, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
     }
     else {
       // update
@@ -306,21 +304,18 @@ public class BucketListWithTagDetailFragment extends FragmentBase<BucketListWith
   private void addAppbarLayoutScrollChange() {
     ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) imageChecker.getLayoutParams();
 
-    appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
-      @Override
-      public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
-        if (Math.abs(verticalOffset) > (appBarLayout.getTotalScrollRange() >> 1)) {
-          // 줄어든 상태
-          textBucketTitle.setTextSize(14);
-          params.topMargin = 0;
-        }
-        else {
-          // 커진 상태
-          textBucketTitle.setTextSize(textSize);
-          params.topMargin = ResourceUtil.dpToPx(6);
-        }
-
+    appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
+      if (Math.abs(verticalOffset) > (appBarLayout.getTotalScrollRange() >> 1)) {
+        // 줄어든 상태
+        textBucketTitle.setTextSize(14);
+        params.topMargin = 0;
       }
+      else {
+        // 커진 상태
+        textBucketTitle.setTextSize(textSize);
+        params.topMargin = ResourceUtil.dpToPx(6);
+      }
+
     });
   }
 }

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

@@ -160,6 +160,7 @@
     </android.support.design.widget.AppBarLayout>
 
     <LinearLayout
+      android:id="@+id/layout_recycler_view_container"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical"
@@ -187,7 +188,7 @@
     android:visibility="gone"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintTop_toBottomOf="@id/scroll_layout"
-    tools:visibility="gone">
+    tools:visibility="visible">
 
     <ImageView
       android:id="@+id/image_result_nothing"