mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Optimize Image Handling and Open Wikidata Media within app (#6187)
* implementing * implementing * implementing * implementing * implementing * make new changes * done --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
		
							parent
							
								
									8dd1091608
								
							
						
					
					
						commit
						d32ab15d42
					
				
					 5 changed files with 215 additions and 11 deletions
				
			
		|  | @ -16,6 +16,7 @@ import android.view.KeyEvent | |||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import android.view.ViewTreeObserver | ||||
| import android.view.ViewTreeObserver.OnGlobalLayoutListener | ||||
| import android.widget.ArrayAdapter | ||||
| import android.widget.Button | ||||
|  | @ -405,9 +406,14 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C | |||
|          * Gets the height of the frame layout as soon as the view is ready and updates aspect ratio | ||||
|          * of the picture. | ||||
|          */ | ||||
|         view.post { | ||||
|             frameLayoutHeight = binding.mediaDetailFrameLayout.measuredHeight | ||||
|             updateAspectRatio(binding.mediaDetailScrollView.width) | ||||
|         view.post{ | ||||
|             val width = binding.mediaDetailScrollView.width | ||||
|             if (width > 0) { | ||||
|                 frameLayoutHeight = binding.mediaDetailFrameLayout.measuredHeight | ||||
|                 updateAspectRatio(width) | ||||
|             } else { | ||||
|                 view.postDelayed({ updateAspectRatio(binding.root.width) }, 1) | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         return view | ||||
|  |  | |||
|  | @ -185,10 +185,12 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple | |||
|      * or a fragment | ||||
|      */ | ||||
|     private void initProvider() { | ||||
|         if (getParentFragment() != null) { | ||||
|         if (getParentFragment() instanceof MediaDetailProvider) { | ||||
|             provider = (MediaDetailProvider) getParentFragment(); | ||||
|         } else { | ||||
|         } else if (getActivity() instanceof MediaDetailProvider) { | ||||
|             provider = (MediaDetailProvider) getActivity(); | ||||
|         } else { | ||||
|             throw new ClassCastException("Parent must implement MediaDetailProvider"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sujal
						Sujal