| 
				
			 | 
			
			
				@@ -15,25 +15,37 @@ import com.reactnativenavigation.params.NavigationParams; 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				 import com.reactnativenavigation.utils.ViewUtils; 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				16
			 | 
			
			
				 import com.reactnativenavigation.views.ContentView; 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				17
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				-public class CollapsingTopBarReactHeader extends ContentView { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+public class CollapsingTopBarReactHeader extends ContentView implements CollapsingTopBarReactHeaderAnimator.OnVisibleListener, CollapsingTopBarReactHeaderAnimator.OnHiddenListener { 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				19
			 | 
			
			
				     private ScrollListener listener; 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				20
			 | 
			
			
				     private boolean mIsScrolling; 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				21
			 | 
			
			
				     private int mTouchSlop; 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				22
			 | 
			
			
				     private int touchDown = -1; 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				23
			 | 
			
			
				     private final JSTouchDispatcher mJSTouchDispatcher = new JSTouchDispatcher(this); 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				24
			 | 
			
			
				     private CollapsingTopBarReactHeaderAnimator visibilityAnimator; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+    private CollapsingTopBarReactHeaderAnimator.OnVisibleListener onVisibleListener; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+    private CollapsingTopBarReactHeaderAnimator.OnHiddenListener onHiddenListener; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+    public void setOnVisibleListener(CollapsingTopBarReactHeaderAnimator.OnVisibleListener onVisibleListener) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+        this.onVisibleListener = onVisibleListener; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+    public void setOnHiddenListener(CollapsingTopBarReactHeaderAnimator.OnHiddenListener onHiddenListener) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+        this.onHiddenListener = onHiddenListener; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				35
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				26
			 | 
			
				36
			 | 
			
			
				     public CollapsingTopBarReactHeader(Context context, CollapsingTopBarParams params, NavigationParams navigationParams, ScrollListener scrollListener) { 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				37
			 | 
			
			
				         super(context, params.reactViewId, navigationParams); 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				38
			 | 
			
			
				         listener = scrollListener; 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				39
			 | 
			
			
				         ViewConfiguration vc = ViewConfiguration.get(context); 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				40
			 | 
			
			
				         mTouchSlop = vc.getScaledTouchSlop(); 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				
			 | 
			
			
				-        visibilityAnimator = createVisibilityAnimator(params.reactViewHeight); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+        createVisibilityAnimator(params.reactViewHeight); 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				42
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				43
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				34
			 | 
			
				
			 | 
			
			
				-    private CollapsingTopBarReactHeaderAnimator createVisibilityAnimator(int reactViewHeight) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+    private void createVisibilityAnimator(int reactViewHeight) { 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				45
			 | 
			
			
				         float height = ViewUtils.convertDpToPixel(reactViewHeight); 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				
			 | 
			
			
				-        return new CollapsingTopBarReactHeaderAnimator(this, height / 2, height / 2); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+        visibilityAnimator = new CollapsingTopBarReactHeaderAnimator(this, height / 2, height / 2); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+        visibilityAnimator.setOnHiddenListener(this); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+        visibilityAnimator.setOnVisibleListener(this); 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				49
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				50
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				39
			 | 
			
				51
			 | 
			
			
				     public void collapse(float amount) { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -108,4 +120,18 @@ public class CollapsingTopBarReactHeader extends ContentView { 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				120
			 | 
			
			
				         EventDispatcher eventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher(); 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				121
			 | 
			
			
				         mJSTouchDispatcher.handleTouchEvent(event, eventDispatcher); 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				122
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				123
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				124
			 | 
			
			
				+    @Override 
			 | 
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				+    public void onVisible() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				+        if (onVisibleListener != null) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				+            onVisibleListener.onVisible(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				130
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				131
			 | 
			
			
				+    @Override 
			 | 
		
	
		
			
			| 
				
			 | 
			
				132
			 | 
			
			
				+    public void onHidden() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				133
			 | 
			
			
				+        if (onHiddenListener != null) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				+            onHiddenListener.onHidden(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				135
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				136
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				137
			 | 
			
			
				 } 
			 |