ADD week 5
This commit is contained in:
		| @@ -0,0 +1,225 @@ | ||||
| package androidx.fragment.app; | ||||
|  | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.RectF; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import androidx.core.os.CancellationSignal; | ||||
| import androidx.core.view.OneShotPreDrawListener; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.ViewGroupCompat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class FragmentTransitionImpl { | ||||
|     public abstract void addTarget(Object obj, View view); | ||||
|  | ||||
|     public abstract void addTargets(Object obj, ArrayList<View> arrayList); | ||||
|  | ||||
|     public abstract void beginDelayedTransition(ViewGroup viewGroup, Object obj); | ||||
|  | ||||
|     public abstract boolean canHandle(Object obj); | ||||
|  | ||||
|     public abstract Object cloneTransition(Object obj); | ||||
|  | ||||
|     public abstract Object mergeTransitionsInSequence(Object obj, Object obj2, Object obj3); | ||||
|  | ||||
|     public abstract Object mergeTransitionsTogether(Object obj, Object obj2, Object obj3); | ||||
|  | ||||
|     public abstract void removeTarget(Object obj, View view); | ||||
|  | ||||
|     public abstract void replaceTargets(Object obj, ArrayList<View> arrayList, ArrayList<View> arrayList2); | ||||
|  | ||||
|     public abstract void scheduleHideFragmentView(Object obj, View view, ArrayList<View> arrayList); | ||||
|  | ||||
|     public abstract void scheduleRemoveTargets(Object obj, Object obj2, ArrayList<View> arrayList, Object obj3, ArrayList<View> arrayList2, Object obj4, ArrayList<View> arrayList3); | ||||
|  | ||||
|     public abstract void setEpicenter(Object obj, Rect rect); | ||||
|  | ||||
|     public abstract void setEpicenter(Object obj, View view); | ||||
|  | ||||
|     public abstract void setSharedElementTargets(Object obj, View view, ArrayList<View> arrayList); | ||||
|  | ||||
|     public abstract void swapSharedElementTargets(Object obj, ArrayList<View> arrayList, ArrayList<View> arrayList2); | ||||
|  | ||||
|     public abstract Object wrapTransitionInSet(Object obj); | ||||
|  | ||||
|     protected void getBoundsOnScreen(View view, Rect rect) { | ||||
|         if (ViewCompat.isAttachedToWindow(view)) { | ||||
|             RectF rectF = new RectF(); | ||||
|             rectF.set(0.0f, 0.0f, view.getWidth(), view.getHeight()); | ||||
|             view.getMatrix().mapRect(rectF); | ||||
|             rectF.offset(view.getLeft(), view.getTop()); | ||||
|             Object parent = view.getParent(); | ||||
|             while (parent instanceof View) { | ||||
|                 View view2 = (View) parent; | ||||
|                 rectF.offset(-view2.getScrollX(), -view2.getScrollY()); | ||||
|                 view2.getMatrix().mapRect(rectF); | ||||
|                 rectF.offset(view2.getLeft(), view2.getTop()); | ||||
|                 parent = view2.getParent(); | ||||
|             } | ||||
|             view.getRootView().getLocationOnScreen(new int[2]); | ||||
|             rectF.offset(r1[0], r1[1]); | ||||
|             rect.set(Math.round(rectF.left), Math.round(rectF.top), Math.round(rectF.right), Math.round(rectF.bottom)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     ArrayList<String> prepareSetNameOverridesReordered(ArrayList<View> arrayList) { | ||||
|         ArrayList<String> arrayList2 = new ArrayList<>(); | ||||
|         int size = arrayList.size(); | ||||
|         for (int i = 0; i < size; i++) { | ||||
|             View view = arrayList.get(i); | ||||
|             arrayList2.add(ViewCompat.getTransitionName(view)); | ||||
|             ViewCompat.setTransitionName(view, null); | ||||
|         } | ||||
|         return arrayList2; | ||||
|     } | ||||
|  | ||||
|     void setNameOverridesReordered(View view, final ArrayList<View> arrayList, final ArrayList<View> arrayList2, final ArrayList<String> arrayList3, Map<String, String> map) { | ||||
|         final int size = arrayList2.size(); | ||||
|         final ArrayList arrayList4 = new ArrayList(); | ||||
|         for (int i = 0; i < size; i++) { | ||||
|             View view2 = arrayList.get(i); | ||||
|             String transitionName = ViewCompat.getTransitionName(view2); | ||||
|             arrayList4.add(transitionName); | ||||
|             if (transitionName != null) { | ||||
|                 ViewCompat.setTransitionName(view2, null); | ||||
|                 String str = map.get(transitionName); | ||||
|                 int i2 = 0; | ||||
|                 while (true) { | ||||
|                     if (i2 >= size) { | ||||
|                         break; | ||||
|                     } | ||||
|                     if (str.equals(arrayList3.get(i2))) { | ||||
|                         ViewCompat.setTransitionName(arrayList2.get(i2), transitionName); | ||||
|                         break; | ||||
|                     } | ||||
|                     i2++; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         OneShotPreDrawListener.add(view, new Runnable() { // from class: androidx.fragment.app.FragmentTransitionImpl.1 | ||||
|             @Override // java.lang.Runnable | ||||
|             public void run() { | ||||
|                 for (int i3 = 0; i3 < size; i3++) { | ||||
|                     ViewCompat.setTransitionName((View) arrayList2.get(i3), (String) arrayList3.get(i3)); | ||||
|                     ViewCompat.setTransitionName((View) arrayList.get(i3), (String) arrayList4.get(i3)); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     void captureTransitioningViews(ArrayList<View> arrayList, View view) { | ||||
|         if (view.getVisibility() == 0) { | ||||
|             if (view instanceof ViewGroup) { | ||||
|                 ViewGroup viewGroup = (ViewGroup) view; | ||||
|                 if (ViewGroupCompat.isTransitionGroup(viewGroup)) { | ||||
|                     arrayList.add(viewGroup); | ||||
|                     return; | ||||
|                 } | ||||
|                 int childCount = viewGroup.getChildCount(); | ||||
|                 for (int i = 0; i < childCount; i++) { | ||||
|                     captureTransitioningViews(arrayList, viewGroup.getChildAt(i)); | ||||
|                 } | ||||
|                 return; | ||||
|             } | ||||
|             arrayList.add(view); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void findNamedViews(Map<String, View> map, View view) { | ||||
|         if (view.getVisibility() == 0) { | ||||
|             String transitionName = ViewCompat.getTransitionName(view); | ||||
|             if (transitionName != null) { | ||||
|                 map.put(transitionName, view); | ||||
|             } | ||||
|             if (view instanceof ViewGroup) { | ||||
|                 ViewGroup viewGroup = (ViewGroup) view; | ||||
|                 int childCount = viewGroup.getChildCount(); | ||||
|                 for (int i = 0; i < childCount; i++) { | ||||
|                     findNamedViews(map, viewGroup.getChildAt(i)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setNameOverridesOrdered(View view, final ArrayList<View> arrayList, final Map<String, String> map) { | ||||
|         OneShotPreDrawListener.add(view, new Runnable() { // from class: androidx.fragment.app.FragmentTransitionImpl.2 | ||||
|             @Override // java.lang.Runnable | ||||
|             public void run() { | ||||
|                 int size = arrayList.size(); | ||||
|                 for (int i = 0; i < size; i++) { | ||||
|                     View view2 = (View) arrayList.get(i); | ||||
|                     String transitionName = ViewCompat.getTransitionName(view2); | ||||
|                     if (transitionName != null) { | ||||
|                         ViewCompat.setTransitionName(view2, FragmentTransitionImpl.findKeyForValue(map, transitionName)); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     public void setListenerForTransitionEnd(Fragment fragment, Object obj, CancellationSignal cancellationSignal, Runnable runnable) { | ||||
|         runnable.run(); | ||||
|     } | ||||
|  | ||||
|     void scheduleNameReset(ViewGroup viewGroup, final ArrayList<View> arrayList, final Map<String, String> map) { | ||||
|         OneShotPreDrawListener.add(viewGroup, new Runnable() { // from class: androidx.fragment.app.FragmentTransitionImpl.3 | ||||
|             @Override // java.lang.Runnable | ||||
|             public void run() { | ||||
|                 int size = arrayList.size(); | ||||
|                 for (int i = 0; i < size; i++) { | ||||
|                     View view = (View) arrayList.get(i); | ||||
|                     ViewCompat.setTransitionName(view, (String) map.get(ViewCompat.getTransitionName(view))); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     protected static void bfsAddViewChildren(List<View> list, View view) { | ||||
|         int size = list.size(); | ||||
|         if (containedBeforeIndex(list, view, size)) { | ||||
|             return; | ||||
|         } | ||||
|         if (ViewCompat.getTransitionName(view) != null) { | ||||
|             list.add(view); | ||||
|         } | ||||
|         for (int i = size; i < list.size(); i++) { | ||||
|             View view2 = list.get(i); | ||||
|             if (view2 instanceof ViewGroup) { | ||||
|                 ViewGroup viewGroup = (ViewGroup) view2; | ||||
|                 int childCount = viewGroup.getChildCount(); | ||||
|                 for (int i2 = 0; i2 < childCount; i2++) { | ||||
|                     View childAt = viewGroup.getChildAt(i2); | ||||
|                     if (!containedBeforeIndex(list, childAt, size) && ViewCompat.getTransitionName(childAt) != null) { | ||||
|                         list.add(childAt); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static boolean containedBeforeIndex(List<View> list, View view, int i) { | ||||
|         for (int i2 = 0; i2 < i; i2++) { | ||||
|             if (list.get(i2) == view) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     protected static boolean isNullOrEmpty(List list) { | ||||
|         return list == null || list.isEmpty(); | ||||
|     } | ||||
|  | ||||
|     static String findKeyForValue(Map<String, String> map, String str) { | ||||
|         for (Map.Entry<String, String> entry : map.entrySet()) { | ||||
|             if (str.equals(entry.getValue())) { | ||||
|                 return entry.getKey(); | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user