2021-08-09 22:50:52 +00:00
package com.discord.utilities.recycler ;
import androidx.recyclerview.widget.LinearLayoutManager ;
import androidx.recyclerview.widget.RecyclerView ;
import c.d.b.a.a ;
import com.discord.app.AppLog ;
2021-11-01 07:19:03 +00:00
import d0.g0.w ;
import d0.z.d.m ;
2021-08-09 22:50:52 +00:00
import kotlin.jvm.internal.DefaultConstructorMarker ;
/* compiled from: SelfHealingLinearLayoutManager.kt */
public final class SelfHealingLinearLayoutManager extends LinearLayoutManager {
private final RecyclerView . Adapter < ? > adapter ;
private final RecyclerView recyclerView ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public SelfHealingLinearLayoutManager ( RecyclerView recyclerView , RecyclerView . Adapter < ? > adapter , int i , boolean z2 ) {
super ( recyclerView . getContext ( ) , i , z2 ) ;
m . checkNotNullParameter ( recyclerView , " recyclerView " ) ;
m . checkNotNullParameter ( adapter , " adapter " ) ;
this . recyclerView = recyclerView ;
this . adapter = adapter ;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ SelfHealingLinearLayoutManager ( RecyclerView recyclerView , RecyclerView . Adapter adapter , int i , boolean z2 , int i2 , DefaultConstructorMarker defaultConstructorMarker ) {
this ( recyclerView , adapter , ( i2 & 4 ) ! = 0 ? 1 : i , ( i2 & 8 ) ! = 0 ? false : z2 ) ;
}
public static final /* synthetic */ RecyclerView . Adapter access$getAdapter$p ( SelfHealingLinearLayoutManager selfHealingLinearLayoutManager ) {
return selfHealingLinearLayoutManager . adapter ;
}
public static final /* synthetic */ RecyclerView access$getRecyclerView$p ( SelfHealingLinearLayoutManager selfHealingLinearLayoutManager ) {
return selfHealingLinearLayoutManager . recyclerView ;
}
private final void logWarning ( Throwable th ) {
2021-10-11 07:48:45 +00:00
StringBuilder O = a . O ( " Triggered in adapter: " ) ;
O . append ( this . adapter . getClass ( ) ) ;
AppLog . g . w ( " Invalid adapter configuration. " , new Exception ( O . toString ( ) , th ) ) ;
2021-08-09 22:50:52 +00:00
}
private final void resetAdapter ( Throwable th ) {
this . recyclerView . post ( new SelfHealingLinearLayoutManager$resetAdapter$1 ( this ) ) ;
logWarning ( th ) ;
}
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
public void onLayoutChildren ( RecyclerView . Recycler recycler , RecyclerView . State state ) {
String message ;
m . checkNotNullParameter ( recycler , " recycler " ) ;
m . checkNotNullParameter ( state , " state " ) ;
try {
super . onLayoutChildren ( recycler , state ) ;
} catch ( IndexOutOfBoundsException e ) {
resetAdapter ( e ) ;
} catch ( IllegalArgumentException e2 ) {
resetAdapter ( e2 ) ;
} catch ( RuntimeException e3 ) {
String message2 = e3 . getMessage ( ) ;
if ( ( message2 = = null | | ! w . contains$default ( ( CharSequence ) message2 , ( CharSequence ) " trying to unhide " , false , 2 , ( Object ) null ) ) & & ( ( message = e3 . getMessage ( ) ) = = null | | ! w . contains$default ( ( CharSequence ) message , ( CharSequence ) " trying to hide " , false , 2 , ( Object ) null ) ) ) {
throw e3 ;
}
resetAdapter ( e3 ) ;
}
}
}