From 2ff6bcfcd75b1f1f24fa1a2544d928936c653ecc Mon Sep 17 00:00:00 2001 From: Sergei Kozelko Date: Sat, 21 Jan 2023 12:56:22 +0800 Subject: [PATCH] Ignore NotifyDataSetChanged lint warnings for Markwon adapters (#1228) There is no "more efficient" way to update it --- .../infinityforreddit/activities/CommentActivity.java | 1 + .../infinityforreddit/activities/FullMarkdownActivity.java | 1 + .../infinityforreddit/activities/WikiActivity.java | 2 ++ .../adapters/CommentsListingRecyclerViewAdapter.java | 1 + .../infinityforreddit/adapters/CommentsRecyclerViewAdapter.java | 1 + .../adapters/CustomizeThemeRecyclerViewAdapter.java | 1 - .../adapters/PostDetailRecyclerViewAdapter.java | 1 + .../infinityforreddit/fragments/SidebarFragment.java | 1 + 8 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java index 3db6bf20..8a50549f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -213,6 +213,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA binding.commentContentMarkdownView.setLayoutManager(new LinearLayoutManagerBugFixed(this)); binding.commentContentMarkdownView.setAdapter(markwonAdapter); markwonAdapter.setMarkdown(postBodyMarkwon, parentBodyMarkdown); + // noinspection NotifyDataSetChanged markwonAdapter.notifyDataSetChanged(); } parentFullname = intent.getStringExtra(EXTRA_PARENT_FULLNAME_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java index 84672e37..bf1b3566 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java @@ -162,6 +162,7 @@ public class FullMarkdownActivity extends BaseActivity { markdownRecyclerView.setLayoutManager(linearLayoutManager); markdownRecyclerView.setAdapter(markwonAdapter); markwonAdapter.setMarkdown(markwon, commentMarkdown); + // noinspection NotifyDataSetChanged markwonAdapter.notifyDataSetChanged(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index 4944592b..09dcd5b6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -204,6 +204,7 @@ public class WikiActivity extends BaseActivity { loadWiki(); } else { markwonAdapter.setMarkdown(markwon, wikiMarkdown); + // noinspection NotifyDataSetChanged markwonAdapter.notifyDataSetChanged(); } } @@ -227,6 +228,7 @@ public class WikiActivity extends BaseActivity { String markdown = new JSONObject(response.body()) .getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.CONTENT_MD_KEY); markwonAdapter.setMarkdown(markwon, Utils.modifyMarkdown(markdown)); + // noinspection NotifyDataSetChanged markwonAdapter.notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); 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 5da62b22..51a60082 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -216,6 +216,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter customThemeSettingsItems) { this.customThemeSettingsItems.clear(); - notifyDataSetChanged(); this.customThemeSettingsItems.addAll(customThemeSettingsItems); notifyDataSetChanged(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 463caeaf..cbafd113 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -643,6 +643,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter