Try fixing ViewPager2's IllegalStateException.

This commit is contained in:
Alex Ning 2021-08-11 23:12:37 +08:00
parent a5197d5e94
commit dc248735c7
7 changed files with 11 additions and 3 deletions

View File

@ -33,7 +33,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
public class Infinity extends Application implements LifecycleObserver { public class Infinity extends Application implements LifecycleObserver {
private AppComponent mAppComponent; private AppComponent mAppComponent;
private NetworkWifiStatusReceiver mNetworkWifiStatusReceiver; private NetworkWifiStatusReceiver mNetworkWifiStatusReceiver;
private boolean lock = false; //private boolean lock = false;
private boolean isSecureMode; private boolean isSecureMode;
@Inject @Inject
@Named("default") @Named("default")

View File

@ -291,7 +291,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
} }
}).attach(); }).attach();
if (savedInstanceState == null && getIntent().getBooleanExtra(EXTRA_VIEW_MESSAGE, false)) { if (savedInstanceState == null && getIntent().getBooleanExtra(EXTRA_VIEW_MESSAGE, false)) {
viewPager2.setCurrentItem(1); viewPager2.setCurrentItem(1, false);
} }
fixViewPager2Sensitivity(viewPager2); fixViewPager2Sensitivity(viewPager2);

View File

@ -211,7 +211,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
if (showMultiReddits) { if (showMultiReddits) {
viewPager.setCurrentItem(2); viewPager.setCurrentItem(2, false);
} }
loadSubscriptions(false); loadSubscriptions(false);

View File

@ -1085,6 +1085,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
} }
public class CommentViewHolder extends RecyclerView.ViewHolder { public class CommentViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.linear_layout_item_comment)
LinearLayout linearLayout;
@BindView(R.id.author_text_view_item_post_comment) @BindView(R.id.author_text_view_item_post_comment)
TextView authorTextView; TextView authorTextView;
@BindView(R.id.author_flair_text_view_item_post_comment) @BindView(R.id.author_flair_text_view_item_post_comment)
@ -1143,6 +1145,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
constraintSet.applyTo(bottomConstraintLayout); constraintSet.applyTo(bottomConstraintLayout);
} }
linearLayout.getLayoutTransition().setAnimateParentHierarchy(false);
if (mShowCommentDivider) { if (mShowCommentDivider) {
commentDivider.setBackgroundColor(mDividerColor); commentDivider.setBackgroundColor(mDividerColor);
commentDivider.setVisibility(View.VISIBLE); commentDivider.setVisibility(View.VISIBLE);

View File

@ -3265,6 +3265,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
constraintSet.applyTo(bottomConstraintLayout); constraintSet.applyTo(bottomConstraintLayout);
} }
((ViewGroup) itemView).getLayoutTransition().setAnimateParentHierarchy(false);
itemView.setBackgroundColor(mCardViewBackgroundColor); itemView.setBackgroundColor(mCardViewBackgroundColor);
postTimeTextView.setTextColor(mSecondaryTextColor); postTimeTextView.setTextColor(mSecondaryTextColor);
titleTextView.setTextColor(mPostTitleColor); titleTextView.setTextColor(mPostTitleColor);

View File

@ -227,6 +227,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
this.messageTextView = messageTextView; this.messageTextView = messageTextView;
this.timeTextView = timeTextView; this.timeTextView = timeTextView;
((ViewGroup) itemView).getLayoutTransition().setAnimateParentHierarchy(false);
messageTextView.setTextColor(Color.WHITE); messageTextView.setTextColor(Color.WHITE);
timeTextView.setTextColor(mSecondaryTextColor); timeTextView.setTextColor(mSecondaryTextColor);
} }

View File

@ -11,6 +11,7 @@
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<LinearLayout <LinearLayout
android:id="@+id/linear_layout_item_comment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"