|
|
@@ -33,11 +33,11 @@ public class MainContentsWeatherView extends MainContentsView implements ViewTre
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
|
|
|
// 초기 위치가 설정된 후 작동
|
|
|
- if (0 < initY) {
|
|
|
+ if (0 <= initY) {
|
|
|
// 현재 위치 - 전체 뷰
|
|
|
- int cy = getScreenY(itemView);
|
|
|
+ float cy = itemView.getY(); //getScreenY(itemView);
|
|
|
// 초기 위치와의 차이( -값 )
|
|
|
- int gap = cy - initY;
|
|
|
+ float gap = cy - initY;
|
|
|
|
|
|
float ty;
|
|
|
// 고정 되는 영역에서는 차이 값만큼 이동, 이때는 제자리에 머물러 있는 것처럼 보임
|
|
|
@@ -54,7 +54,7 @@ public class MainContentsWeatherView extends MainContentsView implements ViewTre
|
|
|
}
|
|
|
|
|
|
private int weatherArea = -ResourceUtil.dpToPx(100);
|
|
|
- private int initY;
|
|
|
+ private float initY = -8969;
|
|
|
private float initWeatherY;
|
|
|
private ViewGroup weather;
|
|
|
|
|
|
@@ -65,6 +65,13 @@ public class MainContentsWeatherView extends MainContentsView implements ViewTre
|
|
|
itemView.getViewTreeObserver().addOnGlobalLayoutListener(this);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void dispose() {
|
|
|
+ Log.i("APP# MainContentsWeatherView | dispose", "|" + " this: " + this);
|
|
|
+ itemView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
|
+ weather = null;
|
|
|
+ }
|
|
|
+
|
|
|
private int getScreenY(View view) {
|
|
|
int containerPos[] = new int[2];
|
|
|
view.getLocationOnScreen(containerPos);
|
|
|
@@ -74,10 +81,10 @@ public class MainContentsWeatherView extends MainContentsView implements ViewTre
|
|
|
|
|
|
@Override
|
|
|
public void onGlobalLayout() {
|
|
|
- itemView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
|
- initWeatherY = weather.getY();
|
|
|
- initY = MainContentsWeatherView.this.getScreenY(itemView);
|
|
|
- Log.i("APP# MainContentsWeatherView | init", "|" + " initWeatherY: " + initWeatherY);
|
|
|
- Log.i("APP# MainContentsWeatherView | init", "|" + " initY: " + initY);
|
|
|
+ if (null != weather) {
|
|
|
+ initWeatherY = weather.getY();
|
|
|
+ initY = itemView.getY(); //getScreenY(itemView);
|
|
|
+ Log.i("APP# MainContentsWeatherView | init", "|" + " initY: " + initY + " initWeatherY: " + initWeatherY + ", this: " + this);
|
|
|
+ }
|
|
|
}
|
|
|
}
|