ADD week 5
This commit is contained in:
		
							
								
								
									
										274
									
								
								02-Easy5/E5/sources/androidx/viewpager2/R.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										274
									
								
								02-Easy5/E5/sources/androidx/viewpager2/R.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,274 @@ | ||||
| package androidx.viewpager2; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class R { | ||||
|  | ||||
|     public static final class attr { | ||||
|         public static final int alpha = 0x7f03002e; | ||||
|         public static final int fastScrollEnabled = 0x7f0301d3; | ||||
|         public static final int fastScrollHorizontalThumbDrawable = 0x7f0301d4; | ||||
|         public static final int fastScrollHorizontalTrackDrawable = 0x7f0301d5; | ||||
|         public static final int fastScrollVerticalThumbDrawable = 0x7f0301d6; | ||||
|         public static final int fastScrollVerticalTrackDrawable = 0x7f0301d7; | ||||
|         public static final int font = 0x7f0301fb; | ||||
|         public static final int fontProviderAuthority = 0x7f0301fd; | ||||
|         public static final int fontProviderCerts = 0x7f0301fe; | ||||
|         public static final int fontProviderFetchStrategy = 0x7f0301ff; | ||||
|         public static final int fontProviderFetchTimeout = 0x7f030200; | ||||
|         public static final int fontProviderPackage = 0x7f030201; | ||||
|         public static final int fontProviderQuery = 0x7f030202; | ||||
|         public static final int fontStyle = 0x7f030204; | ||||
|         public static final int fontVariationSettings = 0x7f030205; | ||||
|         public static final int fontWeight = 0x7f030206; | ||||
|         public static final int layoutManager = 0x7f03026d; | ||||
|         public static final int recyclerViewStyle = 0x7f030396; | ||||
|         public static final int reverseLayout = 0x7f03039c; | ||||
|         public static final int spanCount = 0x7f0303d4; | ||||
|         public static final int stackFromEnd = 0x7f0303df; | ||||
|         public static final int ttcIndex = 0x7f0304b6; | ||||
|  | ||||
|         private attr() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class color { | ||||
|         public static final int notification_action_color_filter = 0x7f0502e9; | ||||
|         public static final int notification_icon_bg_color = 0x7f0502ea; | ||||
|         public static final int ripple_material_light = 0x7f0502f7; | ||||
|         public static final int secondary_text_default_material_light = 0x7f0502f9; | ||||
|  | ||||
|         private color() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class dimen { | ||||
|         public static final int compat_button_inset_horizontal_material = 0x7f060058; | ||||
|         public static final int compat_button_inset_vertical_material = 0x7f060059; | ||||
|         public static final int compat_button_padding_horizontal_material = 0x7f06005a; | ||||
|         public static final int compat_button_padding_vertical_material = 0x7f06005b; | ||||
|         public static final int compat_control_corner_material = 0x7f06005c; | ||||
|         public static final int compat_notification_large_icon_max_height = 0x7f06005d; | ||||
|         public static final int compat_notification_large_icon_max_width = 0x7f06005e; | ||||
|         public static final int fastscroll_default_thickness = 0x7f060092; | ||||
|         public static final int fastscroll_margin = 0x7f060093; | ||||
|         public static final int fastscroll_minimum_range = 0x7f060094; | ||||
|         public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f06009c; | ||||
|         public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f06009d; | ||||
|         public static final int item_touch_helper_swipe_escape_velocity = 0x7f06009e; | ||||
|         public static final int notification_action_icon_size = 0x7f060307; | ||||
|         public static final int notification_action_text_size = 0x7f060308; | ||||
|         public static final int notification_big_circle_margin = 0x7f060309; | ||||
|         public static final int notification_content_margin_start = 0x7f06030a; | ||||
|         public static final int notification_large_icon_height = 0x7f06030b; | ||||
|         public static final int notification_large_icon_width = 0x7f06030c; | ||||
|         public static final int notification_main_column_padding_top = 0x7f06030d; | ||||
|         public static final int notification_media_narrow_margin = 0x7f06030e; | ||||
|         public static final int notification_right_icon_size = 0x7f06030f; | ||||
|         public static final int notification_right_side_padding_top = 0x7f060310; | ||||
|         public static final int notification_small_icon_background_padding = 0x7f060311; | ||||
|         public static final int notification_small_icon_size_as_large = 0x7f060312; | ||||
|         public static final int notification_subtext_size = 0x7f060313; | ||||
|         public static final int notification_top_pad = 0x7f060314; | ||||
|         public static final int notification_top_pad_large_text = 0x7f060315; | ||||
|  | ||||
|         private dimen() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class drawable { | ||||
|         public static final int notification_action_background = 0x7f0700d0; | ||||
|         public static final int notification_bg = 0x7f0700d1; | ||||
|         public static final int notification_bg_low = 0x7f0700d2; | ||||
|         public static final int notification_bg_low_normal = 0x7f0700d3; | ||||
|         public static final int notification_bg_low_pressed = 0x7f0700d4; | ||||
|         public static final int notification_bg_normal = 0x7f0700d5; | ||||
|         public static final int notification_bg_normal_pressed = 0x7f0700d6; | ||||
|         public static final int notification_icon_background = 0x7f0700d7; | ||||
|         public static final int notification_template_icon_bg = 0x7f0700d8; | ||||
|         public static final int notification_template_icon_low_bg = 0x7f0700d9; | ||||
|         public static final int notification_tile_bg = 0x7f0700da; | ||||
|         public static final int notify_panel_notification_icon_bg = 0x7f0700db; | ||||
|  | ||||
|         private drawable() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class id { | ||||
|         public static final int accessibility_action_clickable_span = 0x7f08000f; | ||||
|         public static final int accessibility_custom_action_0 = 0x7f080010; | ||||
|         public static final int accessibility_custom_action_1 = 0x7f080011; | ||||
|         public static final int accessibility_custom_action_10 = 0x7f080012; | ||||
|         public static final int accessibility_custom_action_11 = 0x7f080013; | ||||
|         public static final int accessibility_custom_action_12 = 0x7f080014; | ||||
|         public static final int accessibility_custom_action_13 = 0x7f080015; | ||||
|         public static final int accessibility_custom_action_14 = 0x7f080016; | ||||
|         public static final int accessibility_custom_action_15 = 0x7f080017; | ||||
|         public static final int accessibility_custom_action_16 = 0x7f080018; | ||||
|         public static final int accessibility_custom_action_17 = 0x7f080019; | ||||
|         public static final int accessibility_custom_action_18 = 0x7f08001a; | ||||
|         public static final int accessibility_custom_action_19 = 0x7f08001b; | ||||
|         public static final int accessibility_custom_action_2 = 0x7f08001c; | ||||
|         public static final int accessibility_custom_action_20 = 0x7f08001d; | ||||
|         public static final int accessibility_custom_action_21 = 0x7f08001e; | ||||
|         public static final int accessibility_custom_action_22 = 0x7f08001f; | ||||
|         public static final int accessibility_custom_action_23 = 0x7f080020; | ||||
|         public static final int accessibility_custom_action_24 = 0x7f080021; | ||||
|         public static final int accessibility_custom_action_25 = 0x7f080022; | ||||
|         public static final int accessibility_custom_action_26 = 0x7f080023; | ||||
|         public static final int accessibility_custom_action_27 = 0x7f080024; | ||||
|         public static final int accessibility_custom_action_28 = 0x7f080025; | ||||
|         public static final int accessibility_custom_action_29 = 0x7f080026; | ||||
|         public static final int accessibility_custom_action_3 = 0x7f080027; | ||||
|         public static final int accessibility_custom_action_30 = 0x7f080028; | ||||
|         public static final int accessibility_custom_action_31 = 0x7f080029; | ||||
|         public static final int accessibility_custom_action_4 = 0x7f08002a; | ||||
|         public static final int accessibility_custom_action_5 = 0x7f08002b; | ||||
|         public static final int accessibility_custom_action_6 = 0x7f08002c; | ||||
|         public static final int accessibility_custom_action_7 = 0x7f08002d; | ||||
|         public static final int accessibility_custom_action_8 = 0x7f08002e; | ||||
|         public static final int accessibility_custom_action_9 = 0x7f08002f; | ||||
|         public static final int action_container = 0x7f08003a; | ||||
|         public static final int action_divider = 0x7f08003c; | ||||
|         public static final int action_image = 0x7f08003d; | ||||
|         public static final int action_text = 0x7f080043; | ||||
|         public static final int actions = 0x7f080044; | ||||
|         public static final int async = 0x7f080052; | ||||
|         public static final int blocking = 0x7f08005c; | ||||
|         public static final int chronometer = 0x7f080071; | ||||
|         public static final int dialog_button = 0x7f080095; | ||||
|         public static final int forever = 0x7f0800c2; | ||||
|         public static final int icon = 0x7f0800d4; | ||||
|         public static final int icon_group = 0x7f0800d5; | ||||
|         public static final int info = 0x7f0800dd; | ||||
|         public static final int italic = 0x7f0800e0; | ||||
|         public static final int item_touch_helper_previous_elevation = 0x7f0800e1; | ||||
|         public static final int line1 = 0x7f0800e9; | ||||
|         public static final int line3 = 0x7f0800ea; | ||||
|         public static final int normal = 0x7f080139; | ||||
|         public static final int notification_background = 0x7f08013b; | ||||
|         public static final int notification_main_column = 0x7f08013c; | ||||
|         public static final int notification_main_column_container = 0x7f08013d; | ||||
|         public static final int right_icon = 0x7f08016b; | ||||
|         public static final int right_side = 0x7f08016c; | ||||
|         public static final int tag_accessibility_actions = 0x7f0801ad; | ||||
|         public static final int tag_accessibility_clickable_spans = 0x7f0801ae; | ||||
|         public static final int tag_accessibility_heading = 0x7f0801af; | ||||
|         public static final int tag_accessibility_pane_title = 0x7f0801b0; | ||||
|         public static final int tag_screen_reader_focusable = 0x7f0801b4; | ||||
|         public static final int tag_transition_group = 0x7f0801b6; | ||||
|         public static final int tag_unhandled_key_event_manager = 0x7f0801b7; | ||||
|         public static final int tag_unhandled_key_listeners = 0x7f0801b8; | ||||
|         public static final int text = 0x7f0801ba; | ||||
|         public static final int text2 = 0x7f0801bb; | ||||
|         public static final int time = 0x7f0801ca; | ||||
|         public static final int title = 0x7f0801cb; | ||||
|  | ||||
|         private id() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class integer { | ||||
|         public static final int status_bar_notification_info_maxnum = 0x7f090043; | ||||
|  | ||||
|         private integer() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class layout { | ||||
|         public static final int custom_dialog = 0x7f0b001d; | ||||
|         public static final int notification_action = 0x7f0b0060; | ||||
|         public static final int notification_action_tombstone = 0x7f0b0061; | ||||
|         public static final int notification_template_custom_big = 0x7f0b0062; | ||||
|         public static final int notification_template_icon_group = 0x7f0b0063; | ||||
|         public static final int notification_template_part_chronometer = 0x7f0b0064; | ||||
|         public static final int notification_template_part_time = 0x7f0b0065; | ||||
|  | ||||
|         private layout() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class string { | ||||
|         public static final int status_bar_notification_info_overflow = 0x7f0f00a8; | ||||
|  | ||||
|         private string() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class style { | ||||
|         public static final int TextAppearance_Compat_Notification = 0x7f1001c3; | ||||
|         public static final int TextAppearance_Compat_Notification_Info = 0x7f1001c4; | ||||
|         public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1001c5; | ||||
|         public static final int TextAppearance_Compat_Notification_Time = 0x7f1001c6; | ||||
|         public static final int TextAppearance_Compat_Notification_Title = 0x7f1001c7; | ||||
|         public static final int Widget_Compat_NotificationActionContainer = 0x7f10032d; | ||||
|         public static final int Widget_Compat_NotificationActionText = 0x7f10032e; | ||||
|  | ||||
|         private style() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static final class styleable { | ||||
|         public static final int ColorStateListItem_alpha = 0x00000003; | ||||
|         public static final int ColorStateListItem_android_alpha = 0x00000001; | ||||
|         public static final int ColorStateListItem_android_color = 0x00000000; | ||||
|         public static final int ColorStateListItem_android_lStar = 0x00000002; | ||||
|         public static final int ColorStateListItem_lStar = 0x00000004; | ||||
|         public static final int FontFamilyFont_android_font = 0x00000000; | ||||
|         public static final int FontFamilyFont_android_fontStyle = 0x00000002; | ||||
|         public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004; | ||||
|         public static final int FontFamilyFont_android_fontWeight = 0x00000001; | ||||
|         public static final int FontFamilyFont_android_ttcIndex = 0x00000003; | ||||
|         public static final int FontFamilyFont_font = 0x00000005; | ||||
|         public static final int FontFamilyFont_fontStyle = 0x00000006; | ||||
|         public static final int FontFamilyFont_fontVariationSettings = 0x00000007; | ||||
|         public static final int FontFamilyFont_fontWeight = 0x00000008; | ||||
|         public static final int FontFamilyFont_ttcIndex = 0x00000009; | ||||
|         public static final int FontFamily_fontProviderAuthority = 0x00000000; | ||||
|         public static final int FontFamily_fontProviderCerts = 0x00000001; | ||||
|         public static final int FontFamily_fontProviderFetchStrategy = 0x00000002; | ||||
|         public static final int FontFamily_fontProviderFetchTimeout = 0x00000003; | ||||
|         public static final int FontFamily_fontProviderPackage = 0x00000004; | ||||
|         public static final int FontFamily_fontProviderQuery = 0x00000005; | ||||
|         public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006; | ||||
|         public static final int GradientColorItem_android_color = 0x00000000; | ||||
|         public static final int GradientColorItem_android_offset = 0x00000001; | ||||
|         public static final int GradientColor_android_centerColor = 0x00000007; | ||||
|         public static final int GradientColor_android_centerX = 0x00000003; | ||||
|         public static final int GradientColor_android_centerY = 0x00000004; | ||||
|         public static final int GradientColor_android_endColor = 0x00000001; | ||||
|         public static final int GradientColor_android_endX = 0x0000000a; | ||||
|         public static final int GradientColor_android_endY = 0x0000000b; | ||||
|         public static final int GradientColor_android_gradientRadius = 0x00000005; | ||||
|         public static final int GradientColor_android_startColor = 0x00000000; | ||||
|         public static final int GradientColor_android_startX = 0x00000008; | ||||
|         public static final int GradientColor_android_startY = 0x00000009; | ||||
|         public static final int GradientColor_android_tileMode = 0x00000006; | ||||
|         public static final int GradientColor_android_type = 0x00000002; | ||||
|         public static final int RecyclerView_android_clipToPadding = 0x00000001; | ||||
|         public static final int RecyclerView_android_descendantFocusability = 0x00000002; | ||||
|         public static final int RecyclerView_android_orientation = 0x00000000; | ||||
|         public static final int RecyclerView_fastScrollEnabled = 0x00000003; | ||||
|         public static final int RecyclerView_fastScrollHorizontalThumbDrawable = 0x00000004; | ||||
|         public static final int RecyclerView_fastScrollHorizontalTrackDrawable = 0x00000005; | ||||
|         public static final int RecyclerView_fastScrollVerticalThumbDrawable = 0x00000006; | ||||
|         public static final int RecyclerView_fastScrollVerticalTrackDrawable = 0x00000007; | ||||
|         public static final int RecyclerView_layoutManager = 0x00000008; | ||||
|         public static final int RecyclerView_reverseLayout = 0x00000009; | ||||
|         public static final int RecyclerView_spanCount = 0x0000000a; | ||||
|         public static final int RecyclerView_stackFromEnd = 0x0000000b; | ||||
|         public static final int ViewPager2_android_orientation = 0; | ||||
|         public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, android.R.attr.lStar, ch.mod_p.sre24.e5.R.attr.alpha, ch.mod_p.sre24.e5.R.attr.lStar}; | ||||
|         public static final int[] FontFamily = {ch.mod_p.sre24.e5.R.attr.fontProviderAuthority, ch.mod_p.sre24.e5.R.attr.fontProviderCerts, ch.mod_p.sre24.e5.R.attr.fontProviderFetchStrategy, ch.mod_p.sre24.e5.R.attr.fontProviderFetchTimeout, ch.mod_p.sre24.e5.R.attr.fontProviderPackage, ch.mod_p.sre24.e5.R.attr.fontProviderQuery, ch.mod_p.sre24.e5.R.attr.fontProviderSystemFontFamily}; | ||||
|         public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.font, ch.mod_p.sre24.e5.R.attr.fontStyle, ch.mod_p.sre24.e5.R.attr.fontVariationSettings, ch.mod_p.sre24.e5.R.attr.fontWeight, ch.mod_p.sre24.e5.R.attr.ttcIndex}; | ||||
|         public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY}; | ||||
|         public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset}; | ||||
|         public static final int[] RecyclerView = {android.R.attr.orientation, android.R.attr.clipToPadding, android.R.attr.descendantFocusability, ch.mod_p.sre24.e5.R.attr.fastScrollEnabled, ch.mod_p.sre24.e5.R.attr.fastScrollHorizontalThumbDrawable, ch.mod_p.sre24.e5.R.attr.fastScrollHorizontalTrackDrawable, ch.mod_p.sre24.e5.R.attr.fastScrollVerticalThumbDrawable, ch.mod_p.sre24.e5.R.attr.fastScrollVerticalTrackDrawable, ch.mod_p.sre24.e5.R.attr.layoutManager, ch.mod_p.sre24.e5.R.attr.reverseLayout, ch.mod_p.sre24.e5.R.attr.spanCount, ch.mod_p.sre24.e5.R.attr.stackFromEnd}; | ||||
|         public static final int[] ViewPager2 = {android.R.attr.orientation}; | ||||
|  | ||||
|         private styleable() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private R() { | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,514 @@ | ||||
| package androidx.viewpager2.adapter; | ||||
|  | ||||
| import android.os.Bundle; | ||||
| import android.os.Handler; | ||||
| import android.os.Looper; | ||||
| import android.os.Parcelable; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.ViewParent; | ||||
| import android.widget.FrameLayout; | ||||
| import androidx.collection.ArraySet; | ||||
| import androidx.collection.LongSparseArray; | ||||
| import androidx.core.util.Preconditions; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.fragment.app.Fragment; | ||||
| import androidx.fragment.app.FragmentActivity; | ||||
| import androidx.fragment.app.FragmentManager; | ||||
| import androidx.fragment.app.FragmentTransaction; | ||||
| import androidx.lifecycle.Lifecycle; | ||||
| import androidx.lifecycle.LifecycleEventObserver; | ||||
| import androidx.lifecycle.LifecycleOwner; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
| import androidx.viewpager2.widget.ViewPager2; | ||||
| import java.util.Iterator; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class FragmentStateAdapter extends RecyclerView.Adapter<FragmentViewHolder> implements StatefulAdapter { | ||||
|     private static final long GRACE_WINDOW_TIME_MS = 10000; | ||||
|     private static final String KEY_PREFIX_FRAGMENT = "f#"; | ||||
|     private static final String KEY_PREFIX_STATE = "s#"; | ||||
|     final FragmentManager mFragmentManager; | ||||
|     private FragmentMaxLifecycleEnforcer mFragmentMaxLifecycleEnforcer; | ||||
|     final LongSparseArray<Fragment> mFragments; | ||||
|     private boolean mHasStaleFragments; | ||||
|     boolean mIsInGracePeriod; | ||||
|     private final LongSparseArray<Integer> mItemIdToViewHolder; | ||||
|     final Lifecycle mLifecycle; | ||||
|     private final LongSparseArray<Fragment.SavedState> mSavedStates; | ||||
|  | ||||
|     public abstract Fragment createFragment(int i); | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public long getItemId(int i) { | ||||
|         return i; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public final boolean onFailedToRecycleView(FragmentViewHolder fragmentViewHolder) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public FragmentStateAdapter(FragmentActivity fragmentActivity) { | ||||
|         this(fragmentActivity.getSupportFragmentManager(), fragmentActivity.getLifecycle()); | ||||
|     } | ||||
|  | ||||
|     public FragmentStateAdapter(Fragment fragment) { | ||||
|         this(fragment.getChildFragmentManager(), fragment.getLifecycle()); | ||||
|     } | ||||
|  | ||||
|     public FragmentStateAdapter(FragmentManager fragmentManager, Lifecycle lifecycle) { | ||||
|         this.mFragments = new LongSparseArray<>(); | ||||
|         this.mSavedStates = new LongSparseArray<>(); | ||||
|         this.mItemIdToViewHolder = new LongSparseArray<>(); | ||||
|         this.mIsInGracePeriod = false; | ||||
|         this.mHasStaleFragments = false; | ||||
|         this.mFragmentManager = fragmentManager; | ||||
|         this.mLifecycle = lifecycle; | ||||
|         super.setHasStableIds(true); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public void onAttachedToRecyclerView(RecyclerView recyclerView) { | ||||
|         Preconditions.checkArgument(this.mFragmentMaxLifecycleEnforcer == null); | ||||
|         FragmentMaxLifecycleEnforcer fragmentMaxLifecycleEnforcer = new FragmentMaxLifecycleEnforcer(); | ||||
|         this.mFragmentMaxLifecycleEnforcer = fragmentMaxLifecycleEnforcer; | ||||
|         fragmentMaxLifecycleEnforcer.register(recyclerView); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public void onDetachedFromRecyclerView(RecyclerView recyclerView) { | ||||
|         this.mFragmentMaxLifecycleEnforcer.unregister(recyclerView); | ||||
|         this.mFragmentMaxLifecycleEnforcer = null; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public final FragmentViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { | ||||
|         return FragmentViewHolder.create(viewGroup); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public final void onBindViewHolder(final FragmentViewHolder fragmentViewHolder, int i) { | ||||
|         long itemId = fragmentViewHolder.getItemId(); | ||||
|         int id = fragmentViewHolder.getContainer().getId(); | ||||
|         Long itemForViewHolder = itemForViewHolder(id); | ||||
|         if (itemForViewHolder != null && itemForViewHolder.longValue() != itemId) { | ||||
|             removeFragment(itemForViewHolder.longValue()); | ||||
|             this.mItemIdToViewHolder.remove(itemForViewHolder.longValue()); | ||||
|         } | ||||
|         this.mItemIdToViewHolder.put(itemId, Integer.valueOf(id)); | ||||
|         ensureFragment(i); | ||||
|         final FrameLayout container = fragmentViewHolder.getContainer(); | ||||
|         if (ViewCompat.isAttachedToWindow(container)) { | ||||
|             if (container.getParent() != null) { | ||||
|                 throw new IllegalStateException("Design assumption violated."); | ||||
|             } | ||||
|             container.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.1 | ||||
|                 @Override // android.view.View.OnLayoutChangeListener | ||||
|                 public void onLayoutChange(View view, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) { | ||||
|                     if (container.getParent() != null) { | ||||
|                         container.removeOnLayoutChangeListener(this); | ||||
|                         FragmentStateAdapter.this.placeFragmentInViewHolder(fragmentViewHolder); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|         gcFragments(); | ||||
|     } | ||||
|  | ||||
|     void gcFragments() { | ||||
|         if (!this.mHasStaleFragments || shouldDelayFragmentTransactions()) { | ||||
|             return; | ||||
|         } | ||||
|         ArraySet arraySet = new ArraySet(); | ||||
|         for (int i = 0; i < this.mFragments.size(); i++) { | ||||
|             long keyAt = this.mFragments.keyAt(i); | ||||
|             if (!containsItem(keyAt)) { | ||||
|                 arraySet.add(Long.valueOf(keyAt)); | ||||
|                 this.mItemIdToViewHolder.remove(keyAt); | ||||
|             } | ||||
|         } | ||||
|         if (!this.mIsInGracePeriod) { | ||||
|             this.mHasStaleFragments = false; | ||||
|             for (int i2 = 0; i2 < this.mFragments.size(); i2++) { | ||||
|                 long keyAt2 = this.mFragments.keyAt(i2); | ||||
|                 if (!isFragmentViewBound(keyAt2)) { | ||||
|                     arraySet.add(Long.valueOf(keyAt2)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         Iterator<E> it = arraySet.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             removeFragment(((Long) it.next()).longValue()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private boolean isFragmentViewBound(long j) { | ||||
|         View view; | ||||
|         if (this.mItemIdToViewHolder.containsKey(j)) { | ||||
|             return true; | ||||
|         } | ||||
|         Fragment fragment = this.mFragments.get(j); | ||||
|         return (fragment == null || (view = fragment.getView()) == null || view.getParent() == null) ? false : true; | ||||
|     } | ||||
|  | ||||
|     private Long itemForViewHolder(int i) { | ||||
|         Long l = null; | ||||
|         for (int i2 = 0; i2 < this.mItemIdToViewHolder.size(); i2++) { | ||||
|             if (this.mItemIdToViewHolder.valueAt(i2).intValue() == i) { | ||||
|                 if (l != null) { | ||||
|                     throw new IllegalStateException("Design assumption violated: a ViewHolder can only be bound to one item at a time."); | ||||
|                 } | ||||
|                 l = Long.valueOf(this.mItemIdToViewHolder.keyAt(i2)); | ||||
|             } | ||||
|         } | ||||
|         return l; | ||||
|     } | ||||
|  | ||||
|     private void ensureFragment(int i) { | ||||
|         long itemId = getItemId(i); | ||||
|         if (this.mFragments.containsKey(itemId)) { | ||||
|             return; | ||||
|         } | ||||
|         Fragment createFragment = createFragment(i); | ||||
|         createFragment.setInitialSavedState(this.mSavedStates.get(itemId)); | ||||
|         this.mFragments.put(itemId, createFragment); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public final void onViewAttachedToWindow(FragmentViewHolder fragmentViewHolder) { | ||||
|         placeFragmentInViewHolder(fragmentViewHolder); | ||||
|         gcFragments(); | ||||
|     } | ||||
|  | ||||
|     void placeFragmentInViewHolder(final FragmentViewHolder fragmentViewHolder) { | ||||
|         Fragment fragment = this.mFragments.get(fragmentViewHolder.getItemId()); | ||||
|         if (fragment == null) { | ||||
|             throw new IllegalStateException("Design assumption violated."); | ||||
|         } | ||||
|         FrameLayout container = fragmentViewHolder.getContainer(); | ||||
|         View view = fragment.getView(); | ||||
|         if (!fragment.isAdded() && view != null) { | ||||
|             throw new IllegalStateException("Design assumption violated."); | ||||
|         } | ||||
|         if (fragment.isAdded() && view == null) { | ||||
|             scheduleViewAttach(fragment, container); | ||||
|             return; | ||||
|         } | ||||
|         if (fragment.isAdded() && view.getParent() != null) { | ||||
|             if (view.getParent() != container) { | ||||
|                 addViewToContainer(view, container); | ||||
|             } | ||||
|         } else { | ||||
|             if (fragment.isAdded()) { | ||||
|                 addViewToContainer(view, container); | ||||
|                 return; | ||||
|             } | ||||
|             if (!shouldDelayFragmentTransactions()) { | ||||
|                 scheduleViewAttach(fragment, container); | ||||
|                 this.mFragmentManager.beginTransaction().add(fragment, "f" + fragmentViewHolder.getItemId()).setMaxLifecycle(fragment, Lifecycle.State.STARTED).commitNow(); | ||||
|                 this.mFragmentMaxLifecycleEnforcer.updateFragmentMaxLifecycle(false); | ||||
|                 return; | ||||
|             } | ||||
|             if (this.mFragmentManager.isDestroyed()) { | ||||
|                 return; | ||||
|             } | ||||
|             this.mLifecycle.addObserver(new LifecycleEventObserver() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.2 | ||||
|                 @Override // androidx.lifecycle.LifecycleEventObserver | ||||
|                 public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) { | ||||
|                     if (FragmentStateAdapter.this.shouldDelayFragmentTransactions()) { | ||||
|                         return; | ||||
|                     } | ||||
|                     lifecycleOwner.getLifecycle().removeObserver(this); | ||||
|                     if (ViewCompat.isAttachedToWindow(fragmentViewHolder.getContainer())) { | ||||
|                         FragmentStateAdapter.this.placeFragmentInViewHolder(fragmentViewHolder); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void scheduleViewAttach(final Fragment fragment, final FrameLayout frameLayout) { | ||||
|         this.mFragmentManager.registerFragmentLifecycleCallbacks(new FragmentManager.FragmentLifecycleCallbacks() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.3 | ||||
|             @Override // androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks | ||||
|             public void onFragmentViewCreated(FragmentManager fragmentManager, Fragment fragment2, View view, Bundle bundle) { | ||||
|                 if (fragment2 == fragment) { | ||||
|                     fragmentManager.unregisterFragmentLifecycleCallbacks(this); | ||||
|                     FragmentStateAdapter.this.addViewToContainer(view, frameLayout); | ||||
|                 } | ||||
|             } | ||||
|         }, false); | ||||
|     } | ||||
|  | ||||
|     void addViewToContainer(View view, FrameLayout frameLayout) { | ||||
|         if (frameLayout.getChildCount() > 1) { | ||||
|             throw new IllegalStateException("Design assumption violated."); | ||||
|         } | ||||
|         if (view.getParent() == frameLayout) { | ||||
|             return; | ||||
|         } | ||||
|         if (frameLayout.getChildCount() > 0) { | ||||
|             frameLayout.removeAllViews(); | ||||
|         } | ||||
|         if (view.getParent() != null) { | ||||
|             ((ViewGroup) view.getParent()).removeView(view); | ||||
|         } | ||||
|         frameLayout.addView(view); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public final void onViewRecycled(FragmentViewHolder fragmentViewHolder) { | ||||
|         Long itemForViewHolder = itemForViewHolder(fragmentViewHolder.getContainer().getId()); | ||||
|         if (itemForViewHolder != null) { | ||||
|             removeFragment(itemForViewHolder.longValue()); | ||||
|             this.mItemIdToViewHolder.remove(itemForViewHolder.longValue()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void removeFragment(long j) { | ||||
|         ViewParent parent; | ||||
|         Fragment fragment = this.mFragments.get(j); | ||||
|         if (fragment == null) { | ||||
|             return; | ||||
|         } | ||||
|         if (fragment.getView() != null && (parent = fragment.getView().getParent()) != null) { | ||||
|             ((FrameLayout) parent).removeAllViews(); | ||||
|         } | ||||
|         if (!containsItem(j)) { | ||||
|             this.mSavedStates.remove(j); | ||||
|         } | ||||
|         if (!fragment.isAdded()) { | ||||
|             this.mFragments.remove(j); | ||||
|             return; | ||||
|         } | ||||
|         if (shouldDelayFragmentTransactions()) { | ||||
|             this.mHasStaleFragments = true; | ||||
|             return; | ||||
|         } | ||||
|         if (fragment.isAdded() && containsItem(j)) { | ||||
|             this.mSavedStates.put(j, this.mFragmentManager.saveFragmentInstanceState(fragment)); | ||||
|         } | ||||
|         this.mFragmentManager.beginTransaction().remove(fragment).commitNow(); | ||||
|         this.mFragments.remove(j); | ||||
|     } | ||||
|  | ||||
|     boolean shouldDelayFragmentTransactions() { | ||||
|         return this.mFragmentManager.isStateSaved(); | ||||
|     } | ||||
|  | ||||
|     public boolean containsItem(long j) { | ||||
|         return j >= 0 && j < ((long) getItemCount()); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.Adapter | ||||
|     public final void setHasStableIds(boolean z) { | ||||
|         throw new UnsupportedOperationException("Stable Ids are required for the adapter to function properly, and the adapter takes care of setting the flag."); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.adapter.StatefulAdapter | ||||
|     public final Parcelable saveState() { | ||||
|         Bundle bundle = new Bundle(this.mFragments.size() + this.mSavedStates.size()); | ||||
|         for (int i = 0; i < this.mFragments.size(); i++) { | ||||
|             long keyAt = this.mFragments.keyAt(i); | ||||
|             Fragment fragment = this.mFragments.get(keyAt); | ||||
|             if (fragment != null && fragment.isAdded()) { | ||||
|                 this.mFragmentManager.putFragment(bundle, createKey(KEY_PREFIX_FRAGMENT, keyAt), fragment); | ||||
|             } | ||||
|         } | ||||
|         for (int i2 = 0; i2 < this.mSavedStates.size(); i2++) { | ||||
|             long keyAt2 = this.mSavedStates.keyAt(i2); | ||||
|             if (containsItem(keyAt2)) { | ||||
|                 bundle.putParcelable(createKey(KEY_PREFIX_STATE, keyAt2), this.mSavedStates.get(keyAt2)); | ||||
|             } | ||||
|         } | ||||
|         return bundle; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.adapter.StatefulAdapter | ||||
|     public final void restoreState(Parcelable parcelable) { | ||||
|         if (!this.mSavedStates.isEmpty() || !this.mFragments.isEmpty()) { | ||||
|             throw new IllegalStateException("Expected the adapter to be 'fresh' while restoring state."); | ||||
|         } | ||||
|         Bundle bundle = (Bundle) parcelable; | ||||
|         if (bundle.getClassLoader() == null) { | ||||
|             bundle.setClassLoader(getClass().getClassLoader()); | ||||
|         } | ||||
|         for (String str : bundle.keySet()) { | ||||
|             if (isValidKey(str, KEY_PREFIX_FRAGMENT)) { | ||||
|                 this.mFragments.put(parseIdFromKey(str, KEY_PREFIX_FRAGMENT), this.mFragmentManager.getFragment(bundle, str)); | ||||
|             } else if (isValidKey(str, KEY_PREFIX_STATE)) { | ||||
|                 long parseIdFromKey = parseIdFromKey(str, KEY_PREFIX_STATE); | ||||
|                 Fragment.SavedState savedState = (Fragment.SavedState) bundle.getParcelable(str); | ||||
|                 if (containsItem(parseIdFromKey)) { | ||||
|                     this.mSavedStates.put(parseIdFromKey, savedState); | ||||
|                 } | ||||
|             } else { | ||||
|                 throw new IllegalArgumentException("Unexpected key in savedState: " + str); | ||||
|             } | ||||
|         } | ||||
|         if (this.mFragments.isEmpty()) { | ||||
|             return; | ||||
|         } | ||||
|         this.mHasStaleFragments = true; | ||||
|         this.mIsInGracePeriod = true; | ||||
|         gcFragments(); | ||||
|         scheduleGracePeriodEnd(); | ||||
|     } | ||||
|  | ||||
|     private void scheduleGracePeriodEnd() { | ||||
|         final Handler handler = new Handler(Looper.getMainLooper()); | ||||
|         final Runnable runnable = new Runnable() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.4 | ||||
|             @Override // java.lang.Runnable | ||||
|             public void run() { | ||||
|                 FragmentStateAdapter.this.mIsInGracePeriod = false; | ||||
|                 FragmentStateAdapter.this.gcFragments(); | ||||
|             } | ||||
|         }; | ||||
|         this.mLifecycle.addObserver(new LifecycleEventObserver() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.5 | ||||
|             @Override // androidx.lifecycle.LifecycleEventObserver | ||||
|             public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) { | ||||
|                 if (event == Lifecycle.Event.ON_DESTROY) { | ||||
|                     handler.removeCallbacks(runnable); | ||||
|                     lifecycleOwner.getLifecycle().removeObserver(this); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|         handler.postDelayed(runnable, GRACE_WINDOW_TIME_MS); | ||||
|     } | ||||
|  | ||||
|     private static String createKey(String str, long j) { | ||||
|         return str + j; | ||||
|     } | ||||
|  | ||||
|     private static boolean isValidKey(String str, String str2) { | ||||
|         return str.startsWith(str2) && str.length() > str2.length(); | ||||
|     } | ||||
|  | ||||
|     private static long parseIdFromKey(String str, String str2) { | ||||
|         return Long.parseLong(str.substring(str2.length())); | ||||
|     } | ||||
|  | ||||
|     class FragmentMaxLifecycleEnforcer { | ||||
|         private RecyclerView.AdapterDataObserver mDataObserver; | ||||
|         private LifecycleEventObserver mLifecycleObserver; | ||||
|         private ViewPager2.OnPageChangeCallback mPageChangeCallback; | ||||
|         private long mPrimaryItemId = -1; | ||||
|         private ViewPager2 mViewPager; | ||||
|  | ||||
|         FragmentMaxLifecycleEnforcer() { | ||||
|         } | ||||
|  | ||||
|         void register(RecyclerView recyclerView) { | ||||
|             this.mViewPager = inferViewPager(recyclerView); | ||||
|             ViewPager2.OnPageChangeCallback onPageChangeCallback = new ViewPager2.OnPageChangeCallback() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.FragmentMaxLifecycleEnforcer.1 | ||||
|                 @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|                 public void onPageScrollStateChanged(int i) { | ||||
|                     FragmentMaxLifecycleEnforcer.this.updateFragmentMaxLifecycle(false); | ||||
|                 } | ||||
|  | ||||
|                 @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|                 public void onPageSelected(int i) { | ||||
|                     FragmentMaxLifecycleEnforcer.this.updateFragmentMaxLifecycle(false); | ||||
|                 } | ||||
|             }; | ||||
|             this.mPageChangeCallback = onPageChangeCallback; | ||||
|             this.mViewPager.registerOnPageChangeCallback(onPageChangeCallback); | ||||
|             DataSetChangeObserver dataSetChangeObserver = new DataSetChangeObserver() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.FragmentMaxLifecycleEnforcer.2 | ||||
|                 @Override // androidx.viewpager2.adapter.FragmentStateAdapter.DataSetChangeObserver, androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|                 public void onChanged() { | ||||
|                     FragmentMaxLifecycleEnforcer.this.updateFragmentMaxLifecycle(true); | ||||
|                 } | ||||
|             }; | ||||
|             this.mDataObserver = dataSetChangeObserver; | ||||
|             FragmentStateAdapter.this.registerAdapterDataObserver(dataSetChangeObserver); | ||||
|             this.mLifecycleObserver = new LifecycleEventObserver() { // from class: androidx.viewpager2.adapter.FragmentStateAdapter.FragmentMaxLifecycleEnforcer.3 | ||||
|                 @Override // androidx.lifecycle.LifecycleEventObserver | ||||
|                 public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) { | ||||
|                     FragmentMaxLifecycleEnforcer.this.updateFragmentMaxLifecycle(false); | ||||
|                 } | ||||
|             }; | ||||
|             FragmentStateAdapter.this.mLifecycle.addObserver(this.mLifecycleObserver); | ||||
|         } | ||||
|  | ||||
|         void unregister(RecyclerView recyclerView) { | ||||
|             inferViewPager(recyclerView).unregisterOnPageChangeCallback(this.mPageChangeCallback); | ||||
|             FragmentStateAdapter.this.unregisterAdapterDataObserver(this.mDataObserver); | ||||
|             FragmentStateAdapter.this.mLifecycle.removeObserver(this.mLifecycleObserver); | ||||
|             this.mViewPager = null; | ||||
|         } | ||||
|  | ||||
|         void updateFragmentMaxLifecycle(boolean z) { | ||||
|             int currentItem; | ||||
|             Fragment fragment; | ||||
|             if (FragmentStateAdapter.this.shouldDelayFragmentTransactions() || this.mViewPager.getScrollState() != 0 || FragmentStateAdapter.this.mFragments.isEmpty() || FragmentStateAdapter.this.getItemCount() == 0 || (currentItem = this.mViewPager.getCurrentItem()) >= FragmentStateAdapter.this.getItemCount()) { | ||||
|                 return; | ||||
|             } | ||||
|             long itemId = FragmentStateAdapter.this.getItemId(currentItem); | ||||
|             if ((itemId != this.mPrimaryItemId || z) && (fragment = FragmentStateAdapter.this.mFragments.get(itemId)) != null && fragment.isAdded()) { | ||||
|                 this.mPrimaryItemId = itemId; | ||||
|                 FragmentTransaction beginTransaction = FragmentStateAdapter.this.mFragmentManager.beginTransaction(); | ||||
|                 Fragment fragment2 = null; | ||||
|                 for (int i = 0; i < FragmentStateAdapter.this.mFragments.size(); i++) { | ||||
|                     long keyAt = FragmentStateAdapter.this.mFragments.keyAt(i); | ||||
|                     Fragment valueAt = FragmentStateAdapter.this.mFragments.valueAt(i); | ||||
|                     if (valueAt.isAdded()) { | ||||
|                         if (keyAt != this.mPrimaryItemId) { | ||||
|                             beginTransaction.setMaxLifecycle(valueAt, Lifecycle.State.STARTED); | ||||
|                         } else { | ||||
|                             fragment2 = valueAt; | ||||
|                         } | ||||
|                         valueAt.setMenuVisibility(keyAt == this.mPrimaryItemId); | ||||
|                     } | ||||
|                 } | ||||
|                 if (fragment2 != null) { | ||||
|                     beginTransaction.setMaxLifecycle(fragment2, Lifecycle.State.RESUMED); | ||||
|                 } | ||||
|                 if (beginTransaction.isEmpty()) { | ||||
|                     return; | ||||
|                 } | ||||
|                 beginTransaction.commitNow(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private ViewPager2 inferViewPager(RecyclerView recyclerView) { | ||||
|             ViewParent parent = recyclerView.getParent(); | ||||
|             if (parent instanceof ViewPager2) { | ||||
|                 return (ViewPager2) parent; | ||||
|             } | ||||
|             throw new IllegalStateException("Expected ViewPager2 instance. Got: " + parent); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static abstract class DataSetChangeObserver extends RecyclerView.AdapterDataObserver { | ||||
|         @Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|         public abstract void onChanged(); | ||||
|  | ||||
|         private DataSetChangeObserver() { | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|         public final void onItemRangeChanged(int i, int i2) { | ||||
|             onChanged(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|         public final void onItemRangeChanged(int i, int i2, Object obj) { | ||||
|             onChanged(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|         public final void onItemRangeInserted(int i, int i2) { | ||||
|             onChanged(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|         public final void onItemRangeRemoved(int i, int i2) { | ||||
|             onChanged(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver | ||||
|         public final void onItemRangeMoved(int i, int i2, int i3) { | ||||
|             onChanged(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,25 @@ | ||||
| package androidx.viewpager2.adapter; | ||||
|  | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.FrameLayout; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class FragmentViewHolder extends RecyclerView.ViewHolder { | ||||
|     private FragmentViewHolder(FrameLayout frameLayout) { | ||||
|         super(frameLayout); | ||||
|     } | ||||
|  | ||||
|     static FragmentViewHolder create(ViewGroup viewGroup) { | ||||
|         FrameLayout frameLayout = new FrameLayout(viewGroup.getContext()); | ||||
|         frameLayout.setLayoutParams(new ViewGroup.LayoutParams(-1, -1)); | ||||
|         frameLayout.setId(ViewCompat.generateViewId()); | ||||
|         frameLayout.setSaveEnabled(false); | ||||
|         return new FragmentViewHolder(frameLayout); | ||||
|     } | ||||
|  | ||||
|     FrameLayout getContainer() { | ||||
|         return (FrameLayout) this.itemView; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,10 @@ | ||||
| package androidx.viewpager2.adapter; | ||||
|  | ||||
| import android.os.Parcelable; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public interface StatefulAdapter { | ||||
|     void restoreState(Parcelable parcelable); | ||||
|  | ||||
|     Parcelable saveState(); | ||||
| } | ||||
| @@ -0,0 +1,110 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import android.animation.LayoutTransition; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import androidx.recyclerview.widget.LinearLayoutManager; | ||||
| import java.lang.reflect.Array; | ||||
| import java.util.Arrays; | ||||
| import java.util.Comparator; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| final class AnimateLayoutChangeDetector { | ||||
|     private static final ViewGroup.MarginLayoutParams ZERO_MARGIN_LAYOUT_PARAMS; | ||||
|     private LinearLayoutManager mLayoutManager; | ||||
|  | ||||
|     static { | ||||
|         ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(-1, -1); | ||||
|         ZERO_MARGIN_LAYOUT_PARAMS = marginLayoutParams; | ||||
|         marginLayoutParams.setMargins(0, 0, 0, 0); | ||||
|     } | ||||
|  | ||||
|     AnimateLayoutChangeDetector(LinearLayoutManager linearLayoutManager) { | ||||
|         this.mLayoutManager = linearLayoutManager; | ||||
|     } | ||||
|  | ||||
|     boolean mayHaveInterferingAnimations() { | ||||
|         return (!arePagesLaidOutContiguously() || this.mLayoutManager.getChildCount() <= 1) && hasRunningChangingLayoutTransition(); | ||||
|     } | ||||
|  | ||||
|     private boolean arePagesLaidOutContiguously() { | ||||
|         int top; | ||||
|         int i; | ||||
|         int bottom; | ||||
|         int i2; | ||||
|         int childCount = this.mLayoutManager.getChildCount(); | ||||
|         if (childCount == 0) { | ||||
|             return true; | ||||
|         } | ||||
|         boolean z = this.mLayoutManager.getOrientation() == 0; | ||||
|         int[][] iArr = (int[][]) Array.newInstance((Class<?>) Integer.TYPE, childCount, 2); | ||||
|         for (int i3 = 0; i3 < childCount; i3++) { | ||||
|             View childAt = this.mLayoutManager.getChildAt(i3); | ||||
|             if (childAt == null) { | ||||
|                 throw new IllegalStateException("null view contained in the view hierarchy"); | ||||
|             } | ||||
|             ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams(); | ||||
|             ViewGroup.MarginLayoutParams marginLayoutParams = layoutParams instanceof ViewGroup.MarginLayoutParams ? (ViewGroup.MarginLayoutParams) layoutParams : ZERO_MARGIN_LAYOUT_PARAMS; | ||||
|             int[] iArr2 = iArr[i3]; | ||||
|             if (z) { | ||||
|                 top = childAt.getLeft(); | ||||
|                 i = marginLayoutParams.leftMargin; | ||||
|             } else { | ||||
|                 top = childAt.getTop(); | ||||
|                 i = marginLayoutParams.topMargin; | ||||
|             } | ||||
|             iArr2[0] = top - i; | ||||
|             int[] iArr3 = iArr[i3]; | ||||
|             if (z) { | ||||
|                 bottom = childAt.getRight(); | ||||
|                 i2 = marginLayoutParams.rightMargin; | ||||
|             } else { | ||||
|                 bottom = childAt.getBottom(); | ||||
|                 i2 = marginLayoutParams.bottomMargin; | ||||
|             } | ||||
|             iArr3[1] = bottom + i2; | ||||
|         } | ||||
|         Arrays.sort(iArr, new Comparator<int[]>() { // from class: androidx.viewpager2.widget.AnimateLayoutChangeDetector.1 | ||||
|             @Override // java.util.Comparator | ||||
|             public int compare(int[] iArr4, int[] iArr5) { | ||||
|                 return iArr4[0] - iArr5[0]; | ||||
|             } | ||||
|         }); | ||||
|         for (int i4 = 1; i4 < childCount; i4++) { | ||||
|             if (iArr[i4 - 1][1] != iArr[i4][0]) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         int[] iArr4 = iArr[0]; | ||||
|         int i5 = iArr4[1]; | ||||
|         int i6 = iArr4[0]; | ||||
|         return i6 <= 0 && iArr[childCount - 1][1] >= i5 - i6; | ||||
|     } | ||||
|  | ||||
|     private boolean hasRunningChangingLayoutTransition() { | ||||
|         int childCount = this.mLayoutManager.getChildCount(); | ||||
|         for (int i = 0; i < childCount; i++) { | ||||
|             if (hasRunningChangingLayoutTransition(this.mLayoutManager.getChildAt(i))) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     private static boolean hasRunningChangingLayoutTransition(View view) { | ||||
|         if (view instanceof ViewGroup) { | ||||
|             ViewGroup viewGroup = (ViewGroup) view; | ||||
|             LayoutTransition layoutTransition = viewGroup.getLayoutTransition(); | ||||
|             if (layoutTransition != null && layoutTransition.isChangingLayout()) { | ||||
|                 return true; | ||||
|             } | ||||
|             int childCount = viewGroup.getChildCount(); | ||||
|             for (int i = 0; i < childCount; i++) { | ||||
|                 if (hasRunningChangingLayoutTransition(viewGroup.getChildAt(i))) { | ||||
|                     return true; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,64 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import androidx.viewpager2.widget.ViewPager2; | ||||
| import java.util.ArrayList; | ||||
| import java.util.ConcurrentModificationException; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| final class CompositeOnPageChangeCallback extends ViewPager2.OnPageChangeCallback { | ||||
|     private final List<ViewPager2.OnPageChangeCallback> mCallbacks; | ||||
|  | ||||
|     CompositeOnPageChangeCallback(int i) { | ||||
|         this.mCallbacks = new ArrayList(i); | ||||
|     } | ||||
|  | ||||
|     void addOnPageChangeCallback(ViewPager2.OnPageChangeCallback onPageChangeCallback) { | ||||
|         this.mCallbacks.add(onPageChangeCallback); | ||||
|     } | ||||
|  | ||||
|     void removeOnPageChangeCallback(ViewPager2.OnPageChangeCallback onPageChangeCallback) { | ||||
|         this.mCallbacks.remove(onPageChangeCallback); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|     public void onPageScrolled(int i, float f, int i2) { | ||||
|         try { | ||||
|             Iterator<ViewPager2.OnPageChangeCallback> it = this.mCallbacks.iterator(); | ||||
|             while (it.hasNext()) { | ||||
|                 it.next().onPageScrolled(i, f, i2); | ||||
|             } | ||||
|         } catch (ConcurrentModificationException e) { | ||||
|             throwCallbackListModifiedWhileInUse(e); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|     public void onPageSelected(int i) { | ||||
|         try { | ||||
|             Iterator<ViewPager2.OnPageChangeCallback> it = this.mCallbacks.iterator(); | ||||
|             while (it.hasNext()) { | ||||
|                 it.next().onPageSelected(i); | ||||
|             } | ||||
|         } catch (ConcurrentModificationException e) { | ||||
|             throwCallbackListModifiedWhileInUse(e); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|     public void onPageScrollStateChanged(int i) { | ||||
|         try { | ||||
|             Iterator<ViewPager2.OnPageChangeCallback> it = this.mCallbacks.iterator(); | ||||
|             while (it.hasNext()) { | ||||
|                 it.next().onPageScrollStateChanged(i); | ||||
|             } | ||||
|         } catch (ConcurrentModificationException e) { | ||||
|             throwCallbackListModifiedWhileInUse(e); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void throwCallbackListModifiedWhileInUse(ConcurrentModificationException concurrentModificationException) { | ||||
|         throw new IllegalStateException("Adding and removing callbacks during dispatch to callbacks is not supported", concurrentModificationException); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,28 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import android.view.View; | ||||
| import androidx.viewpager2.widget.ViewPager2; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class CompositePageTransformer implements ViewPager2.PageTransformer { | ||||
|     private final List<ViewPager2.PageTransformer> mTransformers = new ArrayList(); | ||||
|  | ||||
|     public void addTransformer(ViewPager2.PageTransformer pageTransformer) { | ||||
|         this.mTransformers.add(pageTransformer); | ||||
|     } | ||||
|  | ||||
|     public void removeTransformer(ViewPager2.PageTransformer pageTransformer) { | ||||
|         this.mTransformers.remove(pageTransformer); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.PageTransformer | ||||
|     public void transformPage(View view, float f) { | ||||
|         Iterator<ViewPager2.PageTransformer> it = this.mTransformers.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             it.next().transformPage(view, f); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										94
									
								
								02-Easy5/E5/sources/androidx/viewpager2/widget/FakeDrag.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								02-Easy5/E5/sources/androidx/viewpager2/widget/FakeDrag.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import android.os.SystemClock; | ||||
| import android.view.MotionEvent; | ||||
| import android.view.VelocityTracker; | ||||
| import android.view.ViewConfiguration; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| final class FakeDrag { | ||||
|     private int mActualDraggedDistance; | ||||
|     private long mFakeDragBeginTime; | ||||
|     private int mMaximumVelocity; | ||||
|     private final RecyclerView mRecyclerView; | ||||
|     private float mRequestedDragDistance; | ||||
|     private final ScrollEventAdapter mScrollEventAdapter; | ||||
|     private VelocityTracker mVelocityTracker; | ||||
|     private final ViewPager2 mViewPager; | ||||
|  | ||||
|     FakeDrag(ViewPager2 viewPager2, ScrollEventAdapter scrollEventAdapter, RecyclerView recyclerView) { | ||||
|         this.mViewPager = viewPager2; | ||||
|         this.mScrollEventAdapter = scrollEventAdapter; | ||||
|         this.mRecyclerView = recyclerView; | ||||
|     } | ||||
|  | ||||
|     boolean isFakeDragging() { | ||||
|         return this.mScrollEventAdapter.isFakeDragging(); | ||||
|     } | ||||
|  | ||||
|     boolean beginFakeDrag() { | ||||
|         if (this.mScrollEventAdapter.isDragging()) { | ||||
|             return false; | ||||
|         } | ||||
|         this.mActualDraggedDistance = 0; | ||||
|         this.mRequestedDragDistance = 0; | ||||
|         this.mFakeDragBeginTime = SystemClock.uptimeMillis(); | ||||
|         beginFakeVelocityTracker(); | ||||
|         this.mScrollEventAdapter.notifyBeginFakeDrag(); | ||||
|         if (!this.mScrollEventAdapter.isIdle()) { | ||||
|             this.mRecyclerView.stopScroll(); | ||||
|         } | ||||
|         addFakeMotionEvent(this.mFakeDragBeginTime, 0, 0.0f, 0.0f); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     boolean fakeDragBy(float f) { | ||||
|         if (!this.mScrollEventAdapter.isFakeDragging()) { | ||||
|             return false; | ||||
|         } | ||||
|         float f2 = this.mRequestedDragDistance - f; | ||||
|         this.mRequestedDragDistance = f2; | ||||
|         int round = Math.round(f2 - this.mActualDraggedDistance); | ||||
|         this.mActualDraggedDistance += round; | ||||
|         long uptimeMillis = SystemClock.uptimeMillis(); | ||||
|         boolean z = this.mViewPager.getOrientation() == 0; | ||||
|         int i = z ? round : 0; | ||||
|         int i2 = z ? 0 : round; | ||||
|         float f3 = z ? this.mRequestedDragDistance : 0.0f; | ||||
|         float f4 = z ? 0.0f : this.mRequestedDragDistance; | ||||
|         this.mRecyclerView.scrollBy(i, i2); | ||||
|         addFakeMotionEvent(uptimeMillis, 2, f3, f4); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     boolean endFakeDrag() { | ||||
|         if (!this.mScrollEventAdapter.isFakeDragging()) { | ||||
|             return false; | ||||
|         } | ||||
|         this.mScrollEventAdapter.notifyEndFakeDrag(); | ||||
|         VelocityTracker velocityTracker = this.mVelocityTracker; | ||||
|         velocityTracker.computeCurrentVelocity(1000, this.mMaximumVelocity); | ||||
|         if (this.mRecyclerView.fling((int) velocityTracker.getXVelocity(), (int) velocityTracker.getYVelocity())) { | ||||
|             return true; | ||||
|         } | ||||
|         this.mViewPager.snapToPage(); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private void beginFakeVelocityTracker() { | ||||
|         VelocityTracker velocityTracker = this.mVelocityTracker; | ||||
|         if (velocityTracker == null) { | ||||
|             this.mVelocityTracker = VelocityTracker.obtain(); | ||||
|             this.mMaximumVelocity = ViewConfiguration.get(this.mViewPager.getContext()).getScaledMaximumFlingVelocity(); | ||||
|         } else { | ||||
|             velocityTracker.clear(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void addFakeMotionEvent(long j, int i, float f, float f2) { | ||||
|         MotionEvent obtain = MotionEvent.obtain(this.mFakeDragBeginTime, j, i, f, f2, 0); | ||||
|         this.mVelocityTracker.addMovement(obtain); | ||||
|         obtain.recycle(); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,40 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import android.view.View; | ||||
| import android.view.ViewParent; | ||||
| import androidx.core.util.Preconditions; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
| import androidx.viewpager2.widget.ViewPager2; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class MarginPageTransformer implements ViewPager2.PageTransformer { | ||||
|     private final int mMarginPx; | ||||
|  | ||||
|     public MarginPageTransformer(int i) { | ||||
|         Preconditions.checkArgumentNonnegative(i, "Margin must be non-negative"); | ||||
|         this.mMarginPx = i; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.PageTransformer | ||||
|     public void transformPage(View view, float f) { | ||||
|         ViewPager2 requireViewPager = requireViewPager(view); | ||||
|         float f2 = this.mMarginPx * f; | ||||
|         if (requireViewPager.getOrientation() == 0) { | ||||
|             if (requireViewPager.isRtl()) { | ||||
|                 f2 = -f2; | ||||
|             } | ||||
|             view.setTranslationX(f2); | ||||
|             return; | ||||
|         } | ||||
|         view.setTranslationY(f2); | ||||
|     } | ||||
|  | ||||
|     private ViewPager2 requireViewPager(View view) { | ||||
|         ViewParent parent = view.getParent(); | ||||
|         ViewParent parent2 = parent.getParent(); | ||||
|         if ((parent instanceof RecyclerView) && (parent2 instanceof ViewPager2)) { | ||||
|             return (ViewPager2) parent2; | ||||
|         } | ||||
|         throw new IllegalStateException("Expected the page view to be managed by a ViewPager2 instance."); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,47 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import android.view.View; | ||||
| import androidx.recyclerview.widget.LinearLayoutManager; | ||||
| import androidx.viewpager2.widget.ViewPager2; | ||||
| import java.util.Locale; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| final class PageTransformerAdapter extends ViewPager2.OnPageChangeCallback { | ||||
|     private final LinearLayoutManager mLayoutManager; | ||||
|     private ViewPager2.PageTransformer mPageTransformer; | ||||
|  | ||||
|     ViewPager2.PageTransformer getPageTransformer() { | ||||
|         return this.mPageTransformer; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|     public void onPageScrollStateChanged(int i) { | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|     public void onPageSelected(int i) { | ||||
|     } | ||||
|  | ||||
|     void setPageTransformer(ViewPager2.PageTransformer pageTransformer) { | ||||
|         this.mPageTransformer = pageTransformer; | ||||
|     } | ||||
|  | ||||
|     PageTransformerAdapter(LinearLayoutManager linearLayoutManager) { | ||||
|         this.mLayoutManager = linearLayoutManager; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback | ||||
|     public void onPageScrolled(int i, float f, int i2) { | ||||
|         if (this.mPageTransformer == null) { | ||||
|             return; | ||||
|         } | ||||
|         float f2 = -f; | ||||
|         for (int i3 = 0; i3 < this.mLayoutManager.getChildCount(); i3++) { | ||||
|             View childAt = this.mLayoutManager.getChildAt(i3); | ||||
|             if (childAt == null) { | ||||
|                 throw new IllegalStateException(String.format(Locale.US, "LayoutManager returned a null child at pos %d/%d while transforming pages", Integer.valueOf(i3), Integer.valueOf(this.mLayoutManager.getChildCount()))); | ||||
|             } | ||||
|             this.mPageTransformer.transformPage(childAt, (this.mLayoutManager.getPosition(childAt) - i) + f2); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,353 @@ | ||||
| package androidx.viewpager2.widget; | ||||
|  | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import androidx.recyclerview.widget.LinearLayoutManager; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
| import androidx.viewpager2.widget.ViewPager2; | ||||
| import java.util.Locale; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| final class ScrollEventAdapter extends RecyclerView.OnScrollListener { | ||||
|     private static final int NO_POSITION = -1; | ||||
|     private static final int STATE_IDLE = 0; | ||||
|     private static final int STATE_IN_PROGRESS_FAKE_DRAG = 4; | ||||
|     private static final int STATE_IN_PROGRESS_IMMEDIATE_SCROLL = 3; | ||||
|     private static final int STATE_IN_PROGRESS_MANUAL_DRAG = 1; | ||||
|     private static final int STATE_IN_PROGRESS_SMOOTH_SCROLL = 2; | ||||
|     private int mAdapterState; | ||||
|     private ViewPager2.OnPageChangeCallback mCallback; | ||||
|     private boolean mDataSetChangeHappened; | ||||
|     private boolean mDispatchSelected; | ||||
|     private int mDragStartPosition; | ||||
|     private boolean mFakeDragging; | ||||
|     private final LinearLayoutManager mLayoutManager; | ||||
|     private final RecyclerView mRecyclerView; | ||||
|     private boolean mScrollHappened; | ||||
|     private int mScrollState; | ||||
|     private ScrollEventValues mScrollValues; | ||||
|     private int mTarget; | ||||
|     private final ViewPager2 mViewPager; | ||||
|  | ||||
|     private boolean isInAnyDraggingState() { | ||||
|         int i = this.mAdapterState; | ||||
|         return i == 1 || i == 4; | ||||
|     } | ||||
|  | ||||
|     int getScrollState() { | ||||
|         return this.mScrollState; | ||||
|     } | ||||
|  | ||||
|     boolean isDragging() { | ||||
|         return this.mScrollState == 1; | ||||
|     } | ||||
|  | ||||
|     boolean isFakeDragging() { | ||||
|         return this.mFakeDragging; | ||||
|     } | ||||
|  | ||||
|     boolean isIdle() { | ||||
|         return this.mScrollState == 0; | ||||
|     } | ||||
|  | ||||
|     void notifyDataSetChangeHappened() { | ||||
|         this.mDataSetChangeHappened = true; | ||||
|     } | ||||
|  | ||||
|     void setOnPageChangeCallback(ViewPager2.OnPageChangeCallback onPageChangeCallback) { | ||||
|         this.mCallback = onPageChangeCallback; | ||||
|     } | ||||
|  | ||||
|     ScrollEventAdapter(ViewPager2 viewPager2) { | ||||
|         this.mViewPager = viewPager2; | ||||
|         RecyclerView recyclerView = viewPager2.mRecyclerView; | ||||
|         this.mRecyclerView = recyclerView; | ||||
|         this.mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); | ||||
|         this.mScrollValues = new ScrollEventValues(); | ||||
|         resetState(); | ||||
|     } | ||||
|  | ||||
|     private void resetState() { | ||||
|         this.mAdapterState = 0; | ||||
|         this.mScrollState = 0; | ||||
|         this.mScrollValues.reset(); | ||||
|         this.mDragStartPosition = -1; | ||||
|         this.mTarget = -1; | ||||
|         this.mDispatchSelected = false; | ||||
|         this.mScrollHappened = false; | ||||
|         this.mFakeDragging = false; | ||||
|         this.mDataSetChangeHappened = false; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener | ||||
|     public void onScrollStateChanged(RecyclerView recyclerView, int i) { | ||||
|         if ((this.mAdapterState != 1 || this.mScrollState != 1) && i == 1) { | ||||
|             startDrag(false); | ||||
|             return; | ||||
|         } | ||||
|         if (isInAnyDraggingState() && i == 2) { | ||||
|             if (this.mScrollHappened) { | ||||
|                 dispatchStateChanged(2); | ||||
|                 this.mDispatchSelected = true; | ||||
|                 return; | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
|         if (isInAnyDraggingState() && i == 0) { | ||||
|             updateScrollEventValues(); | ||||
|             if (!this.mScrollHappened) { | ||||
|                 if (this.mScrollValues.mPosition != -1) { | ||||
|                     dispatchScrolled(this.mScrollValues.mPosition, 0.0f, 0); | ||||
|                 } | ||||
|             } else if (this.mScrollValues.mOffsetPx == 0) { | ||||
|                 if (this.mDragStartPosition != this.mScrollValues.mPosition) { | ||||
|                     dispatchSelected(this.mScrollValues.mPosition); | ||||
|                 } | ||||
|             } | ||||
|             dispatchStateChanged(0); | ||||
|             resetState(); | ||||
|         } | ||||
|         if (this.mAdapterState == 2 && i == 0 && this.mDataSetChangeHappened) { | ||||
|             updateScrollEventValues(); | ||||
|             if (this.mScrollValues.mOffsetPx == 0) { | ||||
|                 if (this.mTarget != this.mScrollValues.mPosition) { | ||||
|                     dispatchSelected(this.mScrollValues.mPosition == -1 ? 0 : this.mScrollValues.mPosition); | ||||
|                 } | ||||
|                 dispatchStateChanged(0); | ||||
|                 resetState(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Code restructure failed: missing block: B:9:0x001d, code lost: | ||||
|      | ||||
|         if ((r5 < 0) == r3.mViewPager.isRtl()) goto L12; | ||||
|      */ | ||||
|     /* JADX WARN: Removed duplicated region for block: B:14:0x0035  */ | ||||
|     @Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener | ||||
|     /* | ||||
|         Code decompiled incorrectly, please refer to instructions dump. | ||||
|         To view partially-correct add '--show-bad-code' argument | ||||
|     */ | ||||
|     public void onScrolled(androidx.recyclerview.widget.RecyclerView r4, int r5, int r6) { | ||||
|         /* | ||||
|             r3 = this; | ||||
|             r4 = 1 | ||||
|             r3.mScrollHappened = r4 | ||||
|             r3.updateScrollEventValues() | ||||
|             boolean r0 = r3.mDispatchSelected | ||||
|             r1 = -1 | ||||
|             r2 = 0 | ||||
|             if (r0 == 0) goto L39 | ||||
|             r3.mDispatchSelected = r2 | ||||
|             if (r6 > 0) goto L1f | ||||
|             if (r6 != 0) goto L2b | ||||
|             if (r5 >= 0) goto L16 | ||||
|             r5 = 1 | ||||
|             goto L17 | ||||
|         L16: | ||||
|             r5 = 0 | ||||
|         L17: | ||||
|             androidx.viewpager2.widget.ViewPager2 r6 = r3.mViewPager | ||||
|             boolean r6 = r6.isRtl() | ||||
|             if (r5 != r6) goto L2b | ||||
|         L1f: | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mOffsetPx | ||||
|             if (r5 == 0) goto L2b | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mPosition | ||||
|             int r5 = r5 + r4 | ||||
|             goto L2f | ||||
|         L2b: | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mPosition | ||||
|         L2f: | ||||
|             r3.mTarget = r5 | ||||
|             int r6 = r3.mDragStartPosition | ||||
|             if (r6 == r5) goto L47 | ||||
|             r3.dispatchSelected(r5) | ||||
|             goto L47 | ||||
|         L39: | ||||
|             int r5 = r3.mAdapterState | ||||
|             if (r5 != 0) goto L47 | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mPosition | ||||
|             if (r5 != r1) goto L44 | ||||
|             r5 = 0 | ||||
|         L44: | ||||
|             r3.dispatchSelected(r5) | ||||
|         L47: | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mPosition | ||||
|             if (r5 != r1) goto L4f | ||||
|             r5 = 0 | ||||
|             goto L53 | ||||
|         L4f: | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mPosition | ||||
|         L53: | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r6 = r3.mScrollValues | ||||
|             float r6 = r6.mOffset | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r0 = r3.mScrollValues | ||||
|             int r0 = r0.mOffsetPx | ||||
|             r3.dispatchScrolled(r5, r6, r0) | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mPosition | ||||
|             int r6 = r3.mTarget | ||||
|             if (r5 == r6) goto L68 | ||||
|             if (r6 != r1) goto L78 | ||||
|         L68: | ||||
|             androidx.viewpager2.widget.ScrollEventAdapter$ScrollEventValues r5 = r3.mScrollValues | ||||
|             int r5 = r5.mOffsetPx | ||||
|             if (r5 != 0) goto L78 | ||||
|             int r5 = r3.mScrollState | ||||
|             if (r5 == r4) goto L78 | ||||
|             r3.dispatchStateChanged(r2) | ||||
|             r3.resetState() | ||||
|         L78: | ||||
|             return | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager2.widget.ScrollEventAdapter.onScrolled(androidx.recyclerview.widget.RecyclerView, int, int):void"); | ||||
|     } | ||||
|  | ||||
|     private void updateScrollEventValues() { | ||||
|         int top; | ||||
|         ScrollEventValues scrollEventValues = this.mScrollValues; | ||||
|         scrollEventValues.mPosition = this.mLayoutManager.findFirstVisibleItemPosition(); | ||||
|         if (scrollEventValues.mPosition == -1) { | ||||
|             scrollEventValues.reset(); | ||||
|             return; | ||||
|         } | ||||
|         View findViewByPosition = this.mLayoutManager.findViewByPosition(scrollEventValues.mPosition); | ||||
|         if (findViewByPosition == null) { | ||||
|             scrollEventValues.reset(); | ||||
|             return; | ||||
|         } | ||||
|         int leftDecorationWidth = this.mLayoutManager.getLeftDecorationWidth(findViewByPosition); | ||||
|         int rightDecorationWidth = this.mLayoutManager.getRightDecorationWidth(findViewByPosition); | ||||
|         int topDecorationHeight = this.mLayoutManager.getTopDecorationHeight(findViewByPosition); | ||||
|         int bottomDecorationHeight = this.mLayoutManager.getBottomDecorationHeight(findViewByPosition); | ||||
|         ViewGroup.LayoutParams layoutParams = findViewByPosition.getLayoutParams(); | ||||
|         if (layoutParams instanceof ViewGroup.MarginLayoutParams) { | ||||
|             ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams; | ||||
|             leftDecorationWidth += marginLayoutParams.leftMargin; | ||||
|             rightDecorationWidth += marginLayoutParams.rightMargin; | ||||
|             topDecorationHeight += marginLayoutParams.topMargin; | ||||
|             bottomDecorationHeight += marginLayoutParams.bottomMargin; | ||||
|         } | ||||
|         int height = findViewByPosition.getHeight() + topDecorationHeight + bottomDecorationHeight; | ||||
|         int width = findViewByPosition.getWidth() + leftDecorationWidth + rightDecorationWidth; | ||||
|         if (this.mLayoutManager.getOrientation() == 0) { | ||||
|             top = (findViewByPosition.getLeft() - leftDecorationWidth) - this.mRecyclerView.getPaddingLeft(); | ||||
|             if (this.mViewPager.isRtl()) { | ||||
|                 top = -top; | ||||
|             } | ||||
|             height = width; | ||||
|         } else { | ||||
|             top = (findViewByPosition.getTop() - topDecorationHeight) - this.mRecyclerView.getPaddingTop(); | ||||
|         } | ||||
|         scrollEventValues.mOffsetPx = -top; | ||||
|         if (scrollEventValues.mOffsetPx < 0) { | ||||
|             if (new AnimateLayoutChangeDetector(this.mLayoutManager).mayHaveInterferingAnimations()) { | ||||
|                 throw new IllegalStateException("Page(s) contain a ViewGroup with a LayoutTransition (or animateLayoutChanges=\"true\"), which interferes with the scrolling animation. Make sure to call getLayoutTransition().setAnimateParentHierarchy(false) on all ViewGroups with a LayoutTransition before an animation is started."); | ||||
|             } | ||||
|             throw new IllegalStateException(String.format(Locale.US, "Page can only be offset by a positive amount, not by %d", Integer.valueOf(scrollEventValues.mOffsetPx))); | ||||
|         } | ||||
|         scrollEventValues.mOffset = height == 0 ? 0.0f : scrollEventValues.mOffsetPx / height; | ||||
|     } | ||||
|  | ||||
|     private void startDrag(boolean z) { | ||||
|         this.mFakeDragging = z; | ||||
|         this.mAdapterState = z ? 4 : 1; | ||||
|         int i = this.mTarget; | ||||
|         if (i != -1) { | ||||
|             this.mDragStartPosition = i; | ||||
|             this.mTarget = -1; | ||||
|         } else if (this.mDragStartPosition == -1) { | ||||
|             this.mDragStartPosition = getPosition(); | ||||
|         } | ||||
|         dispatchStateChanged(1); | ||||
|     } | ||||
|  | ||||
|     void notifyProgrammaticScroll(int i, boolean z) { | ||||
|         this.mAdapterState = z ? 2 : 3; | ||||
|         this.mFakeDragging = false; | ||||
|         boolean z2 = this.mTarget != i; | ||||
|         this.mTarget = i; | ||||
|         dispatchStateChanged(2); | ||||
|         if (z2) { | ||||
|             dispatchSelected(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void notifyBeginFakeDrag() { | ||||
|         this.mAdapterState = 4; | ||||
|         startDrag(true); | ||||
|     } | ||||
|  | ||||
|     void notifyEndFakeDrag() { | ||||
|         if (!isDragging() || this.mFakeDragging) { | ||||
|             this.mFakeDragging = false; | ||||
|             updateScrollEventValues(); | ||||
|             if (this.mScrollValues.mOffsetPx == 0) { | ||||
|                 if (this.mScrollValues.mPosition != this.mDragStartPosition) { | ||||
|                     dispatchSelected(this.mScrollValues.mPosition); | ||||
|                 } | ||||
|                 dispatchStateChanged(0); | ||||
|                 resetState(); | ||||
|                 return; | ||||
|             } | ||||
|             dispatchStateChanged(2); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     double getRelativeScrollPosition() { | ||||
|         updateScrollEventValues(); | ||||
|         return this.mScrollValues.mPosition + this.mScrollValues.mOffset; | ||||
|     } | ||||
|  | ||||
|     private void dispatchStateChanged(int i) { | ||||
|         if ((this.mAdapterState == 3 && this.mScrollState == 0) || this.mScrollState == i) { | ||||
|             return; | ||||
|         } | ||||
|         this.mScrollState = i; | ||||
|         ViewPager2.OnPageChangeCallback onPageChangeCallback = this.mCallback; | ||||
|         if (onPageChangeCallback != null) { | ||||
|             onPageChangeCallback.onPageScrollStateChanged(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void dispatchSelected(int i) { | ||||
|         ViewPager2.OnPageChangeCallback onPageChangeCallback = this.mCallback; | ||||
|         if (onPageChangeCallback != null) { | ||||
|             onPageChangeCallback.onPageSelected(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void dispatchScrolled(int i, float f, int i2) { | ||||
|         ViewPager2.OnPageChangeCallback onPageChangeCallback = this.mCallback; | ||||
|         if (onPageChangeCallback != null) { | ||||
|             onPageChangeCallback.onPageScrolled(i, f, i2); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private int getPosition() { | ||||
|         return this.mLayoutManager.findFirstVisibleItemPosition(); | ||||
|     } | ||||
|  | ||||
|     private static final class ScrollEventValues { | ||||
|         float mOffset; | ||||
|         int mOffsetPx; | ||||
|         int mPosition; | ||||
|  | ||||
|         void reset() { | ||||
|             this.mPosition = -1; | ||||
|             this.mOffset = 0.0f; | ||||
|             this.mOffsetPx = 0; | ||||
|         } | ||||
|  | ||||
|         ScrollEventValues() { | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										1122
									
								
								02-Easy5/E5/sources/androidx/viewpager2/widget/ViewPager2.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1122
									
								
								02-Easy5/E5/sources/androidx/viewpager2/widget/ViewPager2.java
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user