|
|
@@ -7,7 +7,10 @@ import android.os.Bundle;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.PagerSnapHelper;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.support.v7.widget.SnapHelper;
|
|
|
+import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
@@ -49,6 +52,8 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
|
|
|
recyclerViewContentsDetail = findViewById(R.id.recycler_view_contents_detail);
|
|
|
SnapHelper snapHelper = new PagerSnapHelper();
|
|
|
snapHelper.attachToRecyclerView(recyclerViewContentsDetail);
|
|
|
+
|
|
|
+ recyclerViewContentsDetail.addOnScrollListener(scrollEventListener);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -64,6 +69,7 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
|
|
|
.transparent()
|
|
|
.show();
|
|
|
this.actionBarHelper = actionBarHelper;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -74,7 +80,7 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
|
|
|
|
|
|
@Override
|
|
|
protected void onAfterDestroyView() {
|
|
|
-
|
|
|
+ recyclerViewContentsDetail.removeOnScrollListener(scrollEventListener);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -99,9 +105,7 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void render(String url) {
|
|
|
-
|
|
|
- }
|
|
|
+ public void render(String url) {}
|
|
|
|
|
|
@Override
|
|
|
public void setLiked(boolean isChecked) {
|
|
|
@@ -113,6 +117,11 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
|
|
|
actionBarHelper.setBookmarked(isChecked);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void setVisibleDotDotDot(boolean isVisible) {
|
|
|
+ actionBarHelper.setVisibleDotDotDot(isVisible);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void draw(ContentsDetailListBean contentsDetailListBean) {
|
|
|
List<ContentsDetailBean> contentsDetailBeans = contentsDetailListBean.getItemDetailList();
|
|
|
@@ -128,4 +137,22 @@ public class ContentsDetailFragment extends FragmentBase<ContentsDetailPresenter
|
|
|
recyclerViewContentsDetail.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
|
|
|
recyclerViewContentsDetail.setAdapter(adapter);
|
|
|
}
|
|
|
+
|
|
|
+ private int currentPageIndex = 0;
|
|
|
+ private RecyclerView.OnScrollListener scrollEventListener = new RecyclerView.OnScrollListener() {
|
|
|
+ @Override
|
|
|
+ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
+ int index = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition();
|
|
|
+ if (currentPageIndex != index) {
|
|
|
+ currentPageIndex = index;
|
|
|
+ Log.w("APP# ContentsDetailFragment | onScrolled", "|" + "current index ===> " + index);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 액션 바
|
|
|
+ */
|
|
|
+
|
|
|
+ presenter.onChangedPageIndex(currentPageIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
}
|