| 
					
				 | 
			
			
				@@ -1,8 +1,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package eu.kanade.tachiyomi.ui.base.controller 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.os.Bundle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.support.v4.view.MenuItemCompat 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.support.v7.app.AppCompatActivity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.view.LayoutInflater 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.view.MenuItem 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.view.View 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.view.ViewGroup 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bluelinelabs.conductor.ControllerChangeHandler 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -44,4 +46,23 @@ abstract class BaseController(bundle: Bundle? = null) : RestoreViewOnCreateContr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         (activity as? AppCompatActivity)?.supportActionBar?.title = getTitle() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * Workaround for disappearing menu items when collapsing an expandable item like a SearchView. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * This method should be removed when fixed upstream. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * Issue link: https://issuetracker.google.com/issues/37657375 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fun MenuItem.fixExpand() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        val expandListener = object : MenuItemCompat.OnActionExpandListener { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            override fun onMenuItemActionExpand(item: MenuItem): Boolean { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            override fun onMenuItemActionCollapse(item: MenuItem): Boolean { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                activity?.invalidateOptionsMenu() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        MenuItemCompat.setOnActionExpandListener(this, expandListener) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |