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 {
private AppComponent mAppComponent;
private NetworkWifiStatusReceiver mNetworkWifiStatusReceiver;
private boolean lock = false;
//private boolean lock = false;
private boolean isSecureMode;
@Inject
@Named("default")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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