aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-04-08 03:41:42 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-04-08 03:41:42 +0000
commit2c36d46cd01141f1b5600c9f17bcf6807dc637a9 (patch)
treea0c8ea2f9c332c24a44a35c451c99750fd04020b /app/src
parentcd4cf402365e9bdcf652fc7c7a57c28315798e93 (diff)
downloadinfinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.tar
infinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.tar.gz
infinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.tar.bz2
infinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.tar.lz
infinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.tar.xz
infinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.tar.zst
infinity-for-reddit-2c36d46cd01141f1b5600c9f17bcf6807dc637a9.zip
Fix app crashes on ViewSubredditDetailActivity. Fix some themeing issues.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java6
4 files changed, 9 insertions, 14 deletions
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<Recy
case Post.TEXT_TYPE:
((PostDetailViewHolder) holder).mTypeTextView.setText("TEXT");
- if (!mPost.getSelfText().equals("")) {
+ if (mPost.getSelfText() != null && !mPost.getSelfText().equals("")) {
((PostDetailViewHolder) holder).mContentMarkdownView.setVisibility(View.VISIBLE);
LinearLayoutManager linearLayoutManager = new MarkwonLinearLayoutManager(mActivity, new MarkwonLinearLayoutManager.HorizontalScrollViewScrolledListener() {
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java
index cb87a956..2d819696 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java
@@ -152,8 +152,10 @@ public class SidebarFragment extends Fragment {
.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();
}