| 
				
			 | 
			
			
				@@ -4,6 +4,7 @@ import android.content.Context; 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				4
			 | 
			
			
				 import android.content.res.TypedArray; 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				5
			 | 
			
			
				 import android.os.Bundle; 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				 import android.view.View; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7
			 | 
			
			
				+import android.view.ViewGroup; 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				8
			 | 
			
			
				 import android.widget.ScrollView; 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				9
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				9
			 | 
			
				10
			 | 
			
			
				 import com.reactnativenavigation.params.CollapsingTopBarParams; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -12,6 +13,9 @@ import com.reactnativenavigation.utils.ViewUtils; 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				13
			 | 
			
			
				 import com.reactnativenavigation.views.TitleBar; 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				14
			 | 
			
			
				 import com.reactnativenavigation.views.TopBar; 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				15
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				19
			 | 
			
			
				 public class CollapsingTopBar extends TopBar implements CollapsingView { 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				20
			 | 
			
			
				     private CollapsingTopBarBackground collapsingTopBarBackground; 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				21
			 | 
			
			
				     private CollapsingTopBarReactView header; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -27,7 +31,6 @@ public class CollapsingTopBar extends TopBar implements CollapsingView { 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				31
			 | 
			
			
				         this.params = params; 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				32
			 | 
			
			
				         topBarHeight = calculateTopBarHeight(); 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				33
			 | 
			
			
				         createBackgroundImage(params); 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				
			 | 
			
			
				-        createReactView(params); 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				34
			 | 
			
			
				         calculateFinalCollapsedTranslation(params); 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				35
			 | 
			
			
				         viewCollapser = new ViewCollapser(this); 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				36
			 | 
			
			
				     } 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -36,7 +39,7 @@ public class CollapsingTopBar extends TopBar implements CollapsingView { 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				39
			 | 
			
			
				         ViewUtils.runOnPreDraw(this, new Runnable() { 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				40
			 | 
			
			
				             @Override 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				41
			 | 
			
			
				             public void run() { 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				
			 | 
			
			
				-                if (params.hasBackgroundImage()) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+                if (params.hasBackgroundImage() || params.hasReactView()) { 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				43
			 | 
			
			
				                     finalCollapsedTranslation = getCollapsedHeight() - getHeight(); 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				44
			 | 
			
			
				                 } else { 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				45
			 | 
			
			
				                     finalCollapsedTranslation = -titleBar.getHeight(); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -70,7 +73,8 @@ public class CollapsingTopBar extends TopBar implements CollapsingView { 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				73
			 | 
			
			
				         if (params.hasReactView()) { 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				74
			 | 
			
			
				             header = new CollapsingTopBarReactView(getContext(), 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				75
			 | 
			
			
				                     params.reactViewId, 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				
			 | 
			
			
				-                    new NavigationParams(Bundle.EMPTY)); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				+                    new NavigationParams(Bundle.EMPTY), 
			 | 
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				+                    scrollListener); 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				78
			 | 
			
			
				             LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, (int) ViewUtils.convertDpToPixel(params.reactViewHeight)); 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				79
			 | 
			
			
				             titleBarAndContextualMenuContainer.addView(header, lp); 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				80
			 | 
			
			
				         } 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -78,15 +82,26 @@ public class CollapsingTopBar extends TopBar implements CollapsingView { 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				82
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				79
			 | 
			
				83
			 | 
			
			
				     @Override 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				84
			 | 
			
			
				     protected TitleBar createTitleBar() { 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				
			 | 
			
			
				-        if (params.hasBackgroundImage()) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+        if (params.hasBackgroundImage() || params.hasReactView()) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+            createReactView(params); 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				87
			 | 
			
			
				             return new CollapsingTitleBar(getContext(), 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				88
			 | 
			
			
				                     getCollapsedHeight(), 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				
			 | 
			
			
				-                    scrollListener); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				+                    scrollListener, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				+                    params); 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				91
			 | 
			
			
				         } else { 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				92
			 | 
			
			
				             return super.createTitleBar(); 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				93
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				94
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				95
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				+    @Override 
			 | 
		
	
		
			
			| 
				
			 | 
			
				97
			 | 
			
			
				+    protected void addTitleBar() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				+        if (params.hasReactView()) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				+            titleBarAndContextualMenuContainer.addView(titleBar, new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT)); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				100
			 | 
			
			
				+        } else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				101
			 | 
			
			
				+            super.addTitleBar(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				102
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				103
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				104
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				105
			 | 
			
			
				     @Override 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				106
			 | 
			
			
				     public void collapse(CollapseAmount amount) { 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				107
			 | 
			
			
				         viewCollapser.collapse(amount); 
			 |