From 2c36d46cd01141f1b5600c9f17bcf6807dc637a9 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 8 Apr 2020 11:41:42 +0800 Subject: Fix app crashes on ViewSubredditDetailActivity. Fix some themeing issues. --- .../infinityforreddit/Activity/ThemePreviewActivity.java | 9 --------- .../infinityforreddit/Activity/ViewSidebarActivity.java | 6 ++++-- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 2 +- .../infinityforreddit/Fragment/SidebarFragment.java | 6 ++++-- 4 files changed, 9 insertions(+), 14 deletions(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java index f7139075..83478a2f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java @@ -4,9 +4,6 @@ import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.util.TypedValue; @@ -375,12 +372,6 @@ public class ThemePreviewActivity extends AppCompatActivity { protected void applyFABTheme(FloatingActionButton fab) { fab.setBackgroundTintList(ColorStateList.valueOf(customTheme.colorPrimaryLightTheme)); fab.setImageTintList(ColorStateList.valueOf(customTheme.fabIconColor)); - Drawable myFabSrc = getResources().getDrawable(R.drawable.ic_add_day_night_24dp); - if (myFabSrc.getConstantState() != null) { - Drawable willBeWhite = myFabSrc.getConstantState().newDrawable(); - willBeWhite.mutate().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); - fab.setImageDrawable(willBeWhite); - } } public CustomTheme getCustomTheme() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java index d0607455..5dfdad77 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java @@ -169,8 +169,10 @@ public class ViewSidebarActivity extends BaseActivity { .get(SubredditViewModel.class); mSubredditViewModel.getSubredditLiveData().observe(this, subredditData -> { if (subredditData != null) { - markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription()); - markwonAdapter.notifyDataSetChanged(); + if (subredditData.getSidebarDescription() != null && !subredditData.getSidebarDescription().equals("")) { + markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription()); + markwonAdapter.notifyDataSetChanged(); + } } else { fetchSubredditData(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 4027b699..f9b4e22b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -701,7 +701,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { if (subredditData != null) { - markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription()); - markwonAdapter.notifyDataSetChanged(); + if (subredditData.getSidebarDescription() != null && !subredditData.getSidebarDescription().equals("")) { + markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription()); + markwonAdapter.notifyDataSetChanged(); + } } else { fetchSubredditData(); } -- cgit v1.2.3