aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java18
2 files changed, 19 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
index 5e52b063..df672f19 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
@@ -563,7 +563,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
if (canStartActivity) {
canStartActivity = false;
- itemView.callOnClick();
+ itemView.performClick();
}
});
commentMarkdownView.setAdapter(markwonAdapter);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java
index b41b2908..2c5090c7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java
@@ -433,7 +433,25 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
String dataSavingMode = mSharedPreferences.getString(SharedPreferencesUtils.DATA_SAVING_MODE, SharedPreferencesUtils.DATA_SAVING_MODE_OFF);
if (dataSavingMode.equals(SharedPreferencesUtils.DATA_SAVING_MODE_ONLY_ON_CELLULAR_DATA)) {
mAdapter.setDataSavingMode(changeNetworkStatusEvent.connectedNetwork == Utils.NETWORK_TYPE_CELLULAR);
+ refreshAdapter(mCommentRecyclerView, mAdapter);
}
}
}
+
+ private void refreshAdapter(RecyclerView recyclerView, RecyclerView.Adapter<RecyclerView.ViewHolder> adapter) {
+ int previousPosition = -1;
+ if (recyclerView.getLayoutManager() != null) {
+ previousPosition = ((LinearLayoutManagerBugFixed) recyclerView.getLayoutManager()).findFirstVisibleItemPosition();
+ }
+
+ RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
+ recyclerView.setAdapter(null);
+ recyclerView.setLayoutManager(null);
+ recyclerView.setAdapter(adapter);
+ recyclerView.setLayoutManager(layoutManager);
+
+ if (previousPosition > 0) {
+ recyclerView.scrollToPosition(previousPosition);
+ }
+ }
}