aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java5
5 files changed, 15 insertions, 14 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
index 970c9ed6..c2808e97 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
@@ -1,6 +1,7 @@
package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask;
+import android.text.Html;
import android.util.Log;
import org.json.JSONArray;
@@ -116,7 +117,7 @@ class ParseComment {
boolean isSubmitter = data.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
String commentContent = "";
if(!data.isNull(JSONUtils.BODY_HTML_KEY)) {
- commentContent = data.getString(JSONUtils.BODY_HTML_KEY);
+ commentContent = Html.fromHtml(data.getString(JSONUtils.BODY_HTML_KEY).trim()).toString();
}
String permalink = data.getString(JSONUtils.PERMALINK_KEY);
int score = data.getInt(JSONUtils.SCORE_KEY);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
index f3d92f70..6cb68323 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
@@ -1,6 +1,7 @@
package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask;
+import android.text.Html;
import android.util.Log;
import org.json.JSONArray;
@@ -148,7 +149,7 @@ class ParsePost {
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
post.setSelfText("");
} else {
- post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ post.setSelfText(Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim()).toString());
}
bestPostData.add(post);
} else {
@@ -161,7 +162,7 @@ class ParsePost {
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
linkPost.setSelfText("");
} else {
- linkPost.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ linkPost.setSelfText(Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim()).toString());
}
bestPostData.add(linkPost);
}
@@ -252,7 +253,7 @@ class ParsePost {
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
textWithImagePost.setSelfText("");
} else {
- textWithImagePost.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ textWithImagePost.setSelfText(Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim()).toString());
}
bestPostData.add(textWithImagePost);
} else {
@@ -265,7 +266,7 @@ class ParsePost {
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
linkPost.setSelfText("");
} else {
- linkPost.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ linkPost.setSelfText(Html.fromHtml(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim()).toString());
}
linkPost.setPreviewWidth(previewWidth);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java
index 5b2fecb7..0bc59909 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java
@@ -298,7 +298,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
switch (post.getPostType()) {
case Post.IMAGE_TYPE:
- ((DataViewHolder) holder).typeChip.setVisibility(View.VISIBLE);
((DataViewHolder) holder).typeChip.setText("IMAGE");
final String imageUrl = post.getUrl();
@@ -312,7 +311,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.LINK_TYPE:
- ((DataViewHolder) holder).typeChip.setVisibility(View.VISIBLE);
((DataViewHolder) holder).typeChip.setText("LINK");
((DataViewHolder) holder).imageView.setOnClickListener(view -> {
@@ -325,7 +323,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.GIF_VIDEO_TYPE:
- ((DataViewHolder) holder).typeChip.setVisibility(View.VISIBLE);
((DataViewHolder) holder).typeChip.setText("GIF");
final Uri gifVideoUri = Uri.parse(post.getVideoUrl());
@@ -344,7 +341,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.VIDEO_TYPE:
- ((DataViewHolder) holder).typeChip.setVisibility(View.VISIBLE);
((DataViewHolder) holder).typeChip.setText("VIDEO");
final Uri videoUri = Uri.parse(post.getVideoUrl());
@@ -363,7 +359,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.NO_PREVIEW_LINK_TYPE:
- ((DataViewHolder) holder).typeChip.setVisibility(View.VISIBLE);
((DataViewHolder) holder).typeChip.setText("LINK");
final String noPreviewLinkUrl = post.getUrl();
((DataViewHolder) holder).noPreviewLinkImageView.setVisibility(View.VISIBLE);
@@ -377,7 +372,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
});
break;
case Post.TEXT_TYPE:
- ((DataViewHolder) holder).typeChip.setVisibility(View.GONE);
+ ((DataViewHolder) holder).typeChip.setText("TEXT");
break;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java
index 4003c2d4..18fd09cb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java
@@ -2,9 +2,10 @@ package ml.docilealligator.infinityforreddit;
import android.content.SharedPreferences;
import android.os.AsyncTask;
-import androidx.annotation.NonNull;
import android.util.Log;
+import androidx.annotation.NonNull;
+
import java.util.HashMap;
import java.util.Map;
@@ -109,7 +110,7 @@ class UserFollowing {
if(isSubscribing) {
subscribedUserDao.insert(subscribedUserData);
} else {
- subscribedUserDao.deleteSubscribedUser(userName);;
+ subscribedUserDao.deleteSubscribedUser(userName);
}
return null;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
index fb449ac6..55e064df 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
@@ -245,6 +245,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
switch (mPost.getPostType()) {
case Post.IMAGE_TYPE:
mTypeChip.setText("IMAGE");
+
mImageView.setOnClickListener(view -> {
Intent intent = new Intent(ViewPostDetailActivity.this, ViewImageActivity.class);
intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPost.getUrl());
@@ -304,6 +305,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
break;
case Post.NO_PREVIEW_LINK_TYPE:
mTypeChip.setText("LINK");
+
if(!mPost.getSelfText().equals("")) {
mContentMarkdownView.setVisibility(View.VISIBLE);
mContentMarkdownView.setMarkdown(getCustomSpannableConfiguration(), mPost.getSelfText());
@@ -319,7 +321,8 @@ public class ViewPostDetailActivity extends AppCompatActivity {
});
break;
case Post.TEXT_TYPE:
- mTypeChip.setVisibility(View.GONE);
+ mTypeChip.setText("TEXT");
+
if(!mPost.getSelfText().equals("")) {
mContentMarkdownView.setVisibility(View.VISIBLE);
mContentMarkdownView.setMarkdown(getCustomSpannableConfiguration(), mPost.getSelfText());