Sfoglia il codice sorgente

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

hyodong.min 7 anni fa
parent
commit
12a25fc6ea

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

@@ -61,8 +61,11 @@ public class BucketListDetailAdapter extends RecyclerView.Adapter<BucketListDeta
     return position;
   }
 
+
   public void update(List<LifeplusContentsBean> contentsBeans) {
     this.beans = contentsBeans;
     notifyDataSetChanged();
   }
+
+
 }

+ 42 - 1
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.constraint.ConstraintLayout;
+import android.support.v4.widget.NestedScrollView;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
@@ -40,6 +42,9 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
   private RecyclerView recyclerViewBucketListDetail;
   private BucketListDetailAdapter adapter;
 
+  private NestedScrollView scrollLayout;
+  private ConstraintLayout containerLayout;
+
   private TextView textTagTitle;
   private ViewGroup layoutTagContents;
 
@@ -58,6 +63,8 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
   protected void onAfterActivityCreated(Bundle savedInstanceState) {
     findViewById(R.id.layout_bucket_detail_header).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.UPDATE).build()));
 
+    scrollLayout = findViewById(R.id.scroll_layout);
+    containerLayout = findViewById(R.id.container_layout);
     textBucketTitle = findViewById(R.id.text_view_select_bucket);
     imageBucket = findViewById(R.id.image_background);
     imageChecker = findViewById(R.id.image_checker);
@@ -132,7 +139,7 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
         presenter.onEvent(event);
       });
       recyclerViewBucketListDetail.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
-
+      recyclerViewBucketListDetail.setNestedScrollingEnabled(false);
       recyclerViewBucketListDetail.addItemDecoration(new RecyclerView.ItemDecoration() {
         @Override
         public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
@@ -146,6 +153,38 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
       // update
       adapter.update(contentsBeans);
     }
+
+    // TODO: 스크롤 컨트롤 해야됨 
+//    scrollLayout.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
+//      @Override
+//      public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
+//
+//        float imageY = imageBucket.getHeight();
+//
+//        if(scrollY > oldScrollY){
+//          //scroll down
+//          if(scrollY > imageY / 3){
+//            imageBucket.setY(imageY / 3);
+//            scrollLayout.setNestedScrollingEnabled(false);
+//            recyclerViewBucketListDetail.setNestedScrollingEnabled(true);
+//          }
+//
+//        }
+//
+//        if (scrollY < oldScrollY) {
+//          Log.i("APP#  BucketListDetailFragment | onScrollChange", "Scroll UP");
+//          scrollLayout.setNestedScrollingEnabled(true);
+//          recyclerViewBucketListDetail.setNestedScrollingEnabled(false);
+//        }
+//        if(scrollY == 0){
+//          Log.e("APP#  BucketListDetailFragment | onScrollChange", "|" + "Scroll Top");
+//          //imageBucket.setY(imageY);
+//        }
+//        if (scrollY == ( v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight() )) {
+//          Log.e("APP#  BucketListDetailFragment | onScrollChange", "|" + "Bottom scroll");
+//        }
+//      }
+//    });
   }
 
   @Override
@@ -162,4 +201,6 @@ public class BucketListDetailFragment extends FragmentBase<BucketListDetailPrese
   public void setBackground(String url) {
     Glide.with(imageBucket).load(url).into(imageBucket);
   }
+
+
 }

+ 100 - 93
app/src/main/res/layout/fragment_bucket_list_detail.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout
+<android.support.v4.widget.NestedScrollView
+ android:id="@+id/scroll_layout"
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
@@ -8,118 +9,124 @@
   android:orientation="vertical">
 
   <android.support.constraint.ConstraintLayout
-    android:id="@+id/layout_bucket_detail_header"
-    android:layout_width="0dp"
-    android:layout_height="0dp"
-    app:layout_constraintDimensionRatio="H,2:1"
-    app:layout_constraintEnd_toEndOf="parent"
-    app:layout_constraintHeight_max="250dp"
-    app:layout_constraintStart_toStartOf="parent">
-
-    <ImageView
-      android:id="@+id/image_background"
-      android:layout_width="match_parent"
-      android:layout_height="match_parent"
-      android:scaleType="centerCrop"
-      tools:src="@drawable/img_bestbucket_banner_1"/>
+    android:id="@+id/container_layout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <android.support.constraint.ConstraintLayout
-      android:id="@+id/layout_select_bucket"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:paddingStart="80dp"
-      android:paddingEnd="80dp"
-      app:layout_constraintBottom_toBottomOf="parent"
+      android:id="@+id/layout_bucket_detail_header"
+      android:layout_width="0dp"
+      android:layout_height="0dp"
+      app:layout_constraintDimensionRatio="H,2:1"
       app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toTopOf="parent">
+      app:layout_constraintHeight_max="250dp"
+      app:layout_constraintStart_toStartOf="parent">
 
       <ImageView
-        android:id="@+id/image_checker"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintEnd_toStartOf="@+id/text_view_select_bucket"
-        app:layout_constraintHorizontal_chainStyle="packed"
-        android:layout_marginTop="10dp"
-        app:layout_constraintTop_toTopOf="@+id/text_view_select_bucket"
-        app:srcCompat="@drawable/icon_bucket_complete_white"
-        tools:visibility="visible"/>
+        android:id="@+id/image_background"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scaleType="centerCrop"
+        tools:src="@drawable/img_bestbucket_banner_1"/>
 
-      <TextView
-        android:id="@+id/text_view_select_bucket"
+      <android.support.constraint.ConstraintLayout
+        android:id="@+id/layout_select_bucket"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_centerInParent="true"
-        android:layout_marginTop="20dp"
-        android:layout_marginStart="5dp"
-        android:layout_marginBottom="20dp"
-        android:ellipsize="end"
-        android:gravity="center"
-        android:lineSpacingExtra="8sp"
-        android:maxLength="40"
-        android:maxLines="3"
-        android:textColor="@color/CFFFFFF"
-        android:textSize="21dp"
+        android:paddingStart="80dp"
+        android:paddingEnd="80dp"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintHorizontal_chainStyle="packed"
-        app:layout_constraintStart_toEndOf="@+id/image_checker"
-        app:layout_constraintTop_toTopOf="parent"
-        tools:text="OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"/>
-    </android.support.constraint.ConstraintLayout>
-  </android.support.constraint.ConstraintLayout>
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
 
-  <LinearLayout
-    android:id="@+id/layout_tags"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    app:layout_constraintTop_toBottomOf="@+id/layout_bucket_detail_header"
-    >
+        <ImageView
+          android:id="@+id/image_checker"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:layout_marginTop="10dp"
+          app:layout_constraintEnd_toStartOf="@+id/text_view_select_bucket"
+          app:layout_constraintHorizontal_chainStyle="packed"
+          app:layout_constraintTop_toTopOf="@+id/text_view_select_bucket"
+          app:srcCompat="@drawable/icon_bucket_complete_white"
+          tools:visibility="visible"/>
+
+        <TextView
+          android:id="@+id/text_view_select_bucket"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:layout_centerInParent="true"
+          android:layout_marginStart="5dp"
+          android:layout_marginTop="20dp"
+          android:layout_marginBottom="20dp"
+          android:ellipsize="end"
+          android:gravity="center"
+          android:lineSpacingExtra="8sp"
+          android:maxLength="40"
+          android:maxLines="3"
+          android:textColor="@color/CFFFFFF"
+          android:textSize="21dp"
+          app:layout_constraintBottom_toBottomOf="parent"
+          app:layout_constraintHorizontal_chainStyle="packed"
+          app:layout_constraintStart_toEndOf="@+id/image_checker"
+          app:layout_constraintTop_toTopOf="parent"
+          tools:text="OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"/>
+      </android.support.constraint.ConstraintLayout>
+    </android.support.constraint.ConstraintLayout>
 
     <LinearLayout
+      android:id="@+id/layout_tags"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_marginStart="25dp"
-      android:layout_marginTop="18dp"
-      android:layout_marginBottom="13dp"
-      android:orientation="vertical">
+      android:orientation="vertical"
+      app:layout_constraintTop_toBottomOf="@+id/layout_bucket_detail_header"
+      >
 
-      <TextView
-        android:id="@+id/text_title"
+      <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:lineSpacingExtra="4sp"
-        android:text="@string/tag_title"
-        android:textColor="@color/C999999"
-        android:textSize="12sp"
-        />
-    </LinearLayout>
+        android:layout_marginStart="25dp"
+        android:layout_marginTop="18dp"
+        android:layout_marginBottom="13dp"
+        android:orientation="vertical">
 
-    <HorizontalScrollView
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:scrollbars="">
+        <TextView
+          android:id="@+id/text_title"
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:lineSpacingExtra="4sp"
+          android:text="@string/tag_title"
+          android:textColor="@color/C999999"
+          android:textSize="12sp"
+          />
+      </LinearLayout>
 
-      <LinearLayout
-        android:id="@+id/layout_contents"
+      <HorizontalScrollView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginStart="25dp"
-        android:orientation="horizontal"
-        >
+        android:scrollbars="">
 
-      </LinearLayout>
-    </HorizontalScrollView>
-  </LinearLayout>
+        <LinearLayout
+          android:id="@+id/layout_contents"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:layout_marginStart="25dp"
+          android:orientation="horizontal"
+          >
 
-  <android.support.v7.widget.RecyclerView
-    android:id="@+id/recycler_view_bucket_list_detail"
-    android:layout_width="match_parent"
-    android:layout_height="0dp"
-    android:paddingTop="25dp"
-    app:layout_constraintBottom_toBottomOf="parent"
-    app:layout_constraintStart_toStartOf="parent"
-    app:layout_constraintTop_toBottomOf="@+id/layout_tags"
-    app:layout_behavior="@string/appbar_scrolling_view_behavior"
-    />
-</android.support.constraint.ConstraintLayout>
+        </LinearLayout>
+      </HorizontalScrollView>
+    </LinearLayout>
+
+    <android.support.v7.widget.RecyclerView
+      android:id="@+id/recycler_view_bucket_list_detail"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:paddingTop="25dp"
+      app:layout_behavior="@string/appbar_scrolling_view_behavior"
+      app:layout_constraintBottom_toBottomOf="parent"
+      app:layout_constraintStart_toStartOf="parent"
+      app:layout_constraintTop_toBottomOf="@+id/layout_tags"
+      />
+  </android.support.constraint.ConstraintLayout>
+</android.support.v4.widget.NestedScrollView>