Browse Source

[마이][New] 버킷리스트 디테일 앱바 영역 스크롤 안되도록 수정

hyodong.min 7 năm trước cách đây
mục cha
commit
578bca6dc0

+ 18 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/bucketlist/BucketListDetailFragment.java

@@ -4,6 +4,8 @@ import android.graphics.Rect;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
+import android.support.design.widget.AppBarLayout;
+import android.support.design.widget.CoordinatorLayout;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.util.Log;
@@ -42,8 +44,10 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
   private BucketListDetailAdapter adapter;
 
   private TextView textTagTitle;
+  private ViewGroup layoutSelectedBucket;
   private ViewGroup layoutTagContents;
   private ViewGroup layoutNothing;
+  private AppBarLayout appBarLayout;
 
   private TextView textBucketTitle;
   private ImageView imageBucket;
@@ -65,11 +69,25 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
     textTagTitle = findViewById(R.id.text_title);
     layoutTagContents = findViewById(R.id.layout_contents);
     layoutNothing = findViewById(R.id.layout_nothing);
+    layoutSelectedBucket = findViewById(R.id.layout_select_bucket);
     recyclerViewBucketListDetail = findViewById(R.id.recycler_view_bucket_list_detail);
+    appBarLayout = findViewById(R.id.app_bar_layout);
 
     setTagTitle(0);
 
     imageBucket.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.UPDATE).build()));
+
+    if (appBarLayout.getLayoutParams() != null) {
+      CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
+      AppBarLayout.Behavior appBarLayoutBehaviour = new AppBarLayout.Behavior();
+      appBarLayoutBehaviour.setDragCallback(new AppBarLayout.Behavior.DragCallback() {
+        @Override
+        public boolean canDrag(@NonNull AppBarLayout appBarLayout) {
+          return false;
+        }
+      });
+      layoutParams.setBehavior(appBarLayoutBehaviour);
+    }
   }
 
   @Override

+ 13 - 12
app/src/main/res/layout/fragment_bucket_list_detail.xml

@@ -13,6 +13,7 @@
     android:id="@+id/app_bar_layout"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:background="@null"
     app:elevation="0dp">
 
     <android.support.design.widget.CollapsingToolbarLayout
@@ -21,6 +22,18 @@
       android:layout_height="wrap_content"
       app:layout_scrollFlags="scroll|exitUntilCollapsed">
 
+      <android.support.v7.widget.Toolbar
+        android:id="@+id/flexible.example.toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="137dp"
+        android:background="@null"
+        android:visibility="invisible"
+        android:elevation="0dp"
+        app:elevation="0dp"
+        app:layout_collapseMode="pin"
+        app:layout_scrollFlags="scroll|enterAlways"
+        tools:visibility="gone"
+        />
 
       <ImageView
         android:id="@+id/image_background"
@@ -72,18 +85,6 @@
           tools:text="OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"/>
       </android.support.constraint.ConstraintLayout>
 
-      <android.support.v7.widget.Toolbar
-        android:id="@+id/flexible.example.toolbar"
-        android:layout_width="match_parent"
-        android:layout_height="137dp"
-        android:background="@null"
-        android:elevation="0dp"
-        app:elevation="0dp"
-        app:layout_collapseMode="pin"
-        app:layout_scrollFlags="scroll|enterAlways"
-        tools:visibility="gone"
-        />
-
     </android.support.design.widget.CollapsingToolbarLayout>
 
     <LinearLayout