|
|
@@ -3,6 +3,7 @@ package kr.co.zumo.app.lifeplus.view.screen.my.bookmark;
|
|
|
import android.graphics.Paint;
|
|
|
import android.graphics.Rect;
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.constraint.ConstraintLayout;
|
|
|
@@ -58,7 +59,8 @@ public class BookMarkListFragment extends FragmentBase<BookMarkListPresenter> im
|
|
|
private AppBarLayout appBarLayout;
|
|
|
|
|
|
boolean isFirst = true;
|
|
|
- private boolean isLockCategory = false; // 카테고리 변경을 하지 못하게 설정
|
|
|
+ private boolean isLockedCategory = false; // 카테고리 변경을 하지 못하게 설정
|
|
|
+ private boolean isLockedScrollEvent = false; // 카테고리 선택으로 스크롤 시 이벤트 발생을 막음.
|
|
|
|
|
|
@Override
|
|
|
protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
@@ -214,6 +216,10 @@ public class BookMarkListFragment extends FragmentBase<BookMarkListPresenter> im
|
|
|
|
|
|
@Override
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
+ if (isLockedScrollEvent) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
//int firstIndex = layoutManager.findFirstVisibleItemPosition();
|
|
|
int firstCompIndex = layoutManager.findFirstCompletelyVisibleItemPosition();
|
|
|
// int lastIndex = layoutManager.findLastVisibleItemPosition();
|
|
|
@@ -277,9 +283,9 @@ public class BookMarkListFragment extends FragmentBase<BookMarkListPresenter> im
|
|
|
final int index = i;
|
|
|
textView.setOnClickListener(v -> {
|
|
|
setCategoryFocus(index);
|
|
|
- isLockCategory = true;
|
|
|
+ isLockedCategory = true;
|
|
|
presenter.onEvent(new Event.Builder(Event.CATEGORY_CLICK).index(index).build());
|
|
|
- isLockCategory = false;
|
|
|
+ isLockedCategory = false;
|
|
|
});
|
|
|
if (categories[i]) {
|
|
|
textView.setVisibility(View.VISIBLE);
|
|
|
@@ -303,7 +309,7 @@ public class BookMarkListFragment extends FragmentBase<BookMarkListPresenter> im
|
|
|
|
|
|
@Override
|
|
|
public void setCategoryFocus(int categoryIndex) {
|
|
|
- if (isLockCategory) {
|
|
|
+ if (isLockedCategory) {
|
|
|
Log.d("APP# BookMarkListFragment | setCategoryFocus", "|" + " category is locked");
|
|
|
return;
|
|
|
}
|
|
|
@@ -333,11 +339,16 @@ public class BookMarkListFragment extends FragmentBase<BookMarkListPresenter> im
|
|
|
@Override
|
|
|
public void scrollToAnchor(int itemIndex) {
|
|
|
//카테고리별 찍을 때 리스트 가장 상단에 가게 위치 시킴
|
|
|
+ isLockedScrollEvent = true;
|
|
|
layoutManager.scrollToPositionWithOffset(itemIndex, bookMarkListAdapter.getItemCount());
|
|
|
-
|
|
|
+
|
|
|
// appbar 를 스크롤 시키기위해서 가상 이벤트를 전송한다.
|
|
|
// ViewParentCompat.onStartNestedScroll(layoutCoordinator, recyclerView, recyclerView, ViewCompat.SCROLL_AXIS_VERTICAL, ViewCompat.TYPE_NON_TOUCH);
|
|
|
// ViewParentCompat.onNestedPreScroll(layoutCoordinator, recyclerView, 0, 1000, new int[2], ViewCompat.TYPE_NON_TOUCH);
|
|
|
appBarLayout.setExpanded(false);
|
|
|
+
|
|
|
+ new Handler().postDelayed(() -> {
|
|
|
+ isLockedScrollEvent = false;
|
|
|
+ }, 100);
|
|
|
}
|
|
|
}
|