mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-25 02:18:23 +01:00
Display the number of gold given to the post.
This commit is contained in:
parent
d83ded0193
commit
41b243be7d
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -56,4 +56,5 @@ dependencies {
|
|||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
|
||||||
implementation 'org.sufficientlysecure:html-textview:3.6'
|
implementation 'org.sufficientlysecure:html-textview:3.6'
|
||||||
|
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,5 @@ class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
super.onPostExecute(aVoid);
|
super.onPostExecute(aVoid);
|
||||||
loadSubredditIconAsyncTaskListener.loadIconSuccess(iconImageUrl);
|
loadSubredditIconAsyncTaskListener.loadIconSuccess(iconImageUrl);
|
||||||
/*Context context = contextWeakReference.get();
|
|
||||||
CircleImageView circleImageView = circleImageViewWeakReference.get();
|
|
||||||
|
|
||||||
if(context != null && circleImageView != null) {
|
|
||||||
if(!iconImageUrl.equals("")) {
|
|
||||||
Glide.with(context).load(iconImageUrl).into(circleImageView);
|
|
||||||
} else {
|
|
||||||
Glide.with(context).load(R.drawable.subreddit_default_icon).into(circleImageView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
postData.setSubredditIconUrl(iconImageUrl);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class ParsePost {
|
|||||||
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
|
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
|
||||||
String id = data.getString(JSONUtils.ID_KEY);
|
String id = data.getString(JSONUtils.ID_KEY);
|
||||||
String fullName = data.getString(JSONUtils.NAME_KEY);
|
String fullName = data.getString(JSONUtils.NAME_KEY);
|
||||||
String subredditName = data.getString(JSONUtils.SUBREDDIT_NAME_PREFIX_KEY);
|
String subredditNamePrefixed = data.getString(JSONUtils.SUBREDDIT_NAME_PREFIX_KEY);
|
||||||
long postTime = data.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
|
long postTime = data.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
|
||||||
String title = data.getString(JSONUtils.TITLE_KEY);
|
String title = data.getString(JSONUtils.TITLE_KEY);
|
||||||
int score = data.getInt(JSONUtils.SCORE_KEY);
|
int score = data.getInt(JSONUtils.SCORE_KEY);
|
||||||
@ -94,10 +94,10 @@ class ParsePost {
|
|||||||
if(data.has(JSONUtils.CROSSPOST_PARENT_LIST)) {
|
if(data.has(JSONUtils.CROSSPOST_PARENT_LIST)) {
|
||||||
//Cross post
|
//Cross post
|
||||||
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
|
data = data.getJSONArray(JSONUtils.CROSSPOST_PARENT_LIST).getJSONObject(0);
|
||||||
parseData(data, permalink, newPostData, id, fullName, subredditName,
|
parseData(data, permalink, newPostData, id, fullName, subredditNamePrefixed,
|
||||||
formattedPostTime, title, previewUrl, score, voteType, gilded, nsfw, stickied, i);
|
formattedPostTime, title, previewUrl, score, voteType, gilded, nsfw, stickied, i);
|
||||||
} else {
|
} else {
|
||||||
parseData(data, permalink, newPostData, id, fullName, subredditName,
|
parseData(data, permalink, newPostData, id, fullName, subredditNamePrefixed,
|
||||||
formattedPostTime, title, previewUrl, score, voteType, gilded, nsfw, stickied, i);
|
formattedPostTime, title, previewUrl, score, voteType, gilded, nsfw, stickied, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ class ParsePost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void parseData(JSONObject data, String permalink, ArrayList<PostData> bestPostData,
|
private void parseData(JSONObject data, String permalink, ArrayList<PostData> bestPostData,
|
||||||
String id, String fullName, String subredditName, String formattedPostTime,
|
String id, String fullName, String subredditNamePrefixed, String formattedPostTime,
|
||||||
String title, String previewUrl, int score, int voteType, int gilded,
|
String title, String previewUrl, int score, int voteType, int gilded,
|
||||||
boolean nsfw, boolean stickied, int i) throws JSONException {
|
boolean nsfw, boolean stickied, int i) throws JSONException {
|
||||||
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
|
boolean isVideo = data.getBoolean(JSONUtils.IS_VIDEO_KEY);
|
||||||
@ -132,7 +132,7 @@ class ParsePost {
|
|||||||
//Text post
|
//Text post
|
||||||
Log.i("text", Integer.toString(i));
|
Log.i("text", Integer.toString(i));
|
||||||
int postType = PostData.TEXT_TYPE;
|
int postType = PostData.TEXT_TYPE;
|
||||||
PostData postData = new PostData(id, fullName, subredditName, formattedPostTime,
|
PostData postData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
|
||||||
title, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
title, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
||||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||||
postData.setSelfText("");
|
postData.setSelfText("");
|
||||||
@ -144,7 +144,7 @@ class ParsePost {
|
|||||||
//No preview link post
|
//No preview link post
|
||||||
Log.i("no preview link", Integer.toString(i));
|
Log.i("no preview link", Integer.toString(i));
|
||||||
int postType = PostData.NO_PREVIEW_LINK_TYPE;
|
int postType = PostData.NO_PREVIEW_LINK_TYPE;
|
||||||
PostData linkPostData = new PostData(id, fullName, subredditName, formattedPostTime,
|
PostData linkPostData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
|
||||||
title, previewUrl, url, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
title, previewUrl, url, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
||||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||||
linkPostData.setSelfText("");
|
linkPostData.setSelfText("");
|
||||||
@ -160,7 +160,7 @@ class ParsePost {
|
|||||||
int postType = PostData.VIDEO_TYPE;
|
int postType = PostData.VIDEO_TYPE;
|
||||||
String videoUrl = redditVideoObject.getString(JSONUtils.DASH_URL_KEY);
|
String videoUrl = redditVideoObject.getString(JSONUtils.DASH_URL_KEY);
|
||||||
|
|
||||||
PostData videoPostData = new PostData(id, fullName, subredditName, formattedPostTime,
|
PostData videoPostData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
|
||||||
title, previewUrl, permalink, score, postType, voteType, gilded, nsfw, stickied, true);
|
title, previewUrl, permalink, score, postType, voteType, gilded, nsfw, stickied, true);
|
||||||
|
|
||||||
videoPostData.setVideoUrl(videoUrl);
|
videoPostData.setVideoUrl(videoUrl);
|
||||||
@ -175,7 +175,7 @@ class ParsePost {
|
|||||||
int postType = PostData.GIF_VIDEO_TYPE;
|
int postType = PostData.GIF_VIDEO_TYPE;
|
||||||
String videoUrl = variations.getJSONObject(JSONUtils.VARIANTS_KEY).getJSONObject(JSONUtils.MP4_KEY).getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
String videoUrl = variations.getJSONObject(JSONUtils.VARIANTS_KEY).getJSONObject(JSONUtils.MP4_KEY).getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
||||||
String gifDownloadUrl = variations.getJSONObject(JSONUtils.VARIANTS_KEY).getJSONObject(JSONUtils.GIF_KEY).getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
String gifDownloadUrl = variations.getJSONObject(JSONUtils.VARIANTS_KEY).getJSONObject(JSONUtils.GIF_KEY).getJSONObject(JSONUtils.SOURCE_KEY).getString(JSONUtils.URL_KEY);
|
||||||
PostData post = new PostData(id, fullName, subredditName, formattedPostTime, title,
|
PostData post = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime, title,
|
||||||
previewUrl, permalink, score, postType, voteType, gilded, nsfw, stickied, false);
|
previewUrl, permalink, score, postType, voteType, gilded, nsfw, stickied, false);
|
||||||
|
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
@ -190,7 +190,7 @@ class ParsePost {
|
|||||||
String videoUrl = data.getJSONObject(JSONUtils.PREVIEW_KEY)
|
String videoUrl = data.getJSONObject(JSONUtils.PREVIEW_KEY)
|
||||||
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.DASH_URL_KEY);
|
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.DASH_URL_KEY);
|
||||||
|
|
||||||
PostData post = new PostData(id, fullName, subredditName, formattedPostTime, title,
|
PostData post = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime, title,
|
||||||
previewUrl, permalink, score, postType, voteType, gilded, nsfw, stickied, true);
|
previewUrl, permalink, score, postType, voteType, gilded, nsfw, stickied, true);
|
||||||
|
|
||||||
post.setVideoUrl(videoUrl);
|
post.setVideoUrl(videoUrl);
|
||||||
@ -202,13 +202,13 @@ class ParsePost {
|
|||||||
//Image post
|
//Image post
|
||||||
Log.i("image", Integer.toString(i));
|
Log.i("image", Integer.toString(i));
|
||||||
int postType = PostData.IMAGE_TYPE;
|
int postType = PostData.IMAGE_TYPE;
|
||||||
bestPostData.add(new PostData(id, fullName, subredditName, formattedPostTime,
|
bestPostData.add(new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
|
||||||
title, url, url, permalink, score, postType, voteType, gilded, nsfw, stickied));
|
title, url, url, permalink, score, postType, voteType, gilded, nsfw, stickied));
|
||||||
} else {
|
} else {
|
||||||
//Link post
|
//Link post
|
||||||
Log.i("link", Integer.toString(i));
|
Log.i("link", Integer.toString(i));
|
||||||
int postType = PostData.LINK_TYPE;
|
int postType = PostData.LINK_TYPE;
|
||||||
PostData linkPostData = new PostData(id, fullName, subredditName, formattedPostTime,
|
PostData linkPostData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
|
||||||
title, previewUrl, url, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
title, previewUrl, url, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
||||||
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
|
||||||
linkPostData.setSelfText("");
|
linkPostData.setSelfText("");
|
||||||
@ -223,13 +223,13 @@ class ParsePost {
|
|||||||
//Image post
|
//Image post
|
||||||
Log.i("CP no preview image", Integer.toString(i));
|
Log.i("CP no preview image", Integer.toString(i));
|
||||||
int postType = PostData.IMAGE_TYPE;
|
int postType = PostData.IMAGE_TYPE;
|
||||||
bestPostData.add(new PostData(id, fullName, subredditName, formattedPostTime, title,
|
bestPostData.add(new PostData(id, fullName, subredditNamePrefixed, formattedPostTime, title,
|
||||||
url, url, permalink, score, postType, voteType, gilded, nsfw, stickied));
|
url, url, permalink, score, postType, voteType, gilded, nsfw, stickied));
|
||||||
} else {
|
} else {
|
||||||
//Link post
|
//Link post
|
||||||
Log.i("CP no preview link", Integer.toString(i));
|
Log.i("CP no preview link", Integer.toString(i));
|
||||||
int postType = PostData.LINK_TYPE;
|
int postType = PostData.LINK_TYPE;
|
||||||
PostData linkPostData = new PostData(id, fullName, subredditName, formattedPostTime,
|
PostData linkPostData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
|
||||||
title, previewUrl, url, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
title, previewUrl, url, permalink, score, postType, voteType, gilded, nsfw, stickied);
|
||||||
bestPostData.add(linkPostData);
|
bestPostData.add(linkPostData);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class PostData implements Parcelable {
|
|||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String fullName;
|
private String fullName;
|
||||||
private String subredditName;
|
private String subredditNamePrefixed;
|
||||||
private String subredditIconUrl;
|
private String subredditIconUrl;
|
||||||
private String postTime;
|
private String postTime;
|
||||||
private String title;
|
private String title;
|
||||||
@ -36,12 +36,12 @@ class PostData implements Parcelable {
|
|||||||
private boolean isDashVideo;
|
private boolean isDashVideo;
|
||||||
private boolean isDownloadableGifOrVideo;
|
private boolean isDownloadableGifOrVideo;
|
||||||
|
|
||||||
PostData(String id, String fullName, String subredditName, String postTime, String title,
|
PostData(String id, String fullName, String subredditNamePrefixed, String postTime, String title,
|
||||||
String previewUrl, String permalink, int score, int postType, int voteType, int gilded,
|
String previewUrl, String permalink, int score, int postType, int voteType, int gilded,
|
||||||
boolean nsfw, boolean stickied, boolean isDashVideo) {
|
boolean nsfw, boolean stickied, boolean isDashVideo) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.previewUrl = previewUrl;
|
this.previewUrl = previewUrl;
|
||||||
@ -55,12 +55,12 @@ class PostData implements Parcelable {
|
|||||||
this.isDashVideo = isDashVideo;
|
this.isDashVideo = isDashVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
PostData(String id, String fullName, String subredditName, String postTime, String title,
|
PostData(String id, String fullName, String subredditNamePrefixed, String postTime, String title,
|
||||||
String previewUrl, String url, String permalink, int score, int postType, int voteType,
|
String previewUrl, String url, String permalink, int score, int postType, int voteType,
|
||||||
int gilded, boolean nsfw, boolean stickied) {
|
int gilded, boolean nsfw, boolean stickied) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.previewUrl = previewUrl;
|
this.previewUrl = previewUrl;
|
||||||
@ -74,12 +74,12 @@ class PostData implements Parcelable {
|
|||||||
this.stickied = stickied;
|
this.stickied = stickied;
|
||||||
}
|
}
|
||||||
|
|
||||||
PostData(String id, String fullName, String subredditName, String postTime, String title,
|
PostData(String id, String fullName, String subredditNamePrefixed, String postTime, String title,
|
||||||
String permalink, int score, int postType, int voteType, int gilded, boolean nsfw,
|
String permalink, int score, int postType, int voteType, int gilded, boolean nsfw,
|
||||||
boolean stickied) {
|
boolean stickied) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.subredditName = subredditName;
|
this.subredditNamePrefixed = subredditNamePrefixed;
|
||||||
this.postTime = postTime;
|
this.postTime = postTime;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.permalink = RedditUtils.API_BASE_URI + permalink;
|
this.permalink = RedditUtils.API_BASE_URI + permalink;
|
||||||
@ -94,7 +94,7 @@ class PostData implements Parcelable {
|
|||||||
protected PostData(Parcel in) {
|
protected PostData(Parcel in) {
|
||||||
id = in.readString();
|
id = in.readString();
|
||||||
fullName = in.readString();
|
fullName = in.readString();
|
||||||
subredditName = in.readString();
|
subredditNamePrefixed = in.readString();
|
||||||
subredditIconUrl = in.readString();
|
subredditIconUrl = in.readString();
|
||||||
postTime = in.readString();
|
postTime = in.readString();
|
||||||
title = in.readString();
|
title = in.readString();
|
||||||
@ -134,8 +134,8 @@ class PostData implements Parcelable {
|
|||||||
return fullName;
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubredditName() {
|
public String getSubredditNamePrefixed() {
|
||||||
return subredditName;
|
return subredditNamePrefixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubredditIconUrl() {
|
public String getSubredditIconUrl() {
|
||||||
@ -247,7 +247,7 @@ class PostData implements Parcelable {
|
|||||||
public void writeToParcel(Parcel parcel, int i) {
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
parcel.writeString(id);
|
parcel.writeString(id);
|
||||||
parcel.writeString(fullName);
|
parcel.writeString(fullName);
|
||||||
parcel.writeString(subredditName);
|
parcel.writeString(subredditNamePrefixed);
|
||||||
parcel.writeString(subredditIconUrl);
|
parcel.writeString(subredditIconUrl);
|
||||||
parcel.writeString(postTime);
|
parcel.writeString(postTime);
|
||||||
parcel.writeString(title);
|
parcel.writeString(title);
|
||||||
|
@ -92,7 +92,7 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||||||
Log.i("is null", Integer.toString(position));
|
Log.i("is null", Integer.toString(position));
|
||||||
} else {
|
} else {
|
||||||
final String id = mPostData.get(holder.getAdapterPosition()).getFullName();
|
final String id = mPostData.get(holder.getAdapterPosition()).getFullName();
|
||||||
final String subredditName = mPostData.get(holder.getAdapterPosition()).getSubredditName();
|
final String subredditName = mPostData.get(holder.getAdapterPosition()).getSubredditNamePrefixed();
|
||||||
final String postTime = mPostData.get(holder.getAdapterPosition()).getPostTime();
|
final String postTime = mPostData.get(holder.getAdapterPosition()).getPostTime();
|
||||||
final String title = mPostData.get(holder.getAdapterPosition()).getTitle();
|
final String title = mPostData.get(holder.getAdapterPosition()).getTitle();
|
||||||
final String permalink = mPostData.get(holder.getAdapterPosition()).getPermalink();
|
final String permalink = mPostData.get(holder.getAdapterPosition()).getPermalink();
|
||||||
@ -135,6 +135,15 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((DataViewHolder) holder).subredditIconCircleImageView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(mContext, ViewSubredditDetailActivity.class);
|
||||||
|
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME,
|
||||||
|
mPostData.get(holder.getAdapterPosition()).getSubredditNamePrefixed().substring(2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
((DataViewHolder) holder).subredditNameTextView.setText(subredditName);
|
((DataViewHolder) holder).subredditNameTextView.setText(subredditName);
|
||||||
((DataViewHolder) holder).postTimeTextView.setText(postTime);
|
((DataViewHolder) holder).postTimeTextView.setText(postTime);
|
||||||
((DataViewHolder) holder).titleTextView.setText(title);
|
((DataViewHolder) holder).titleTextView.setText(title);
|
||||||
|
@ -105,7 +105,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if(mPostData.getSubredditIconUrl() == null) {
|
if(mPostData.getSubredditIconUrl() == null) {
|
||||||
mLoadSubredditIconAsyncTask = new LoadSubredditIconAsyncTask(
|
mLoadSubredditIconAsyncTask = new LoadSubredditIconAsyncTask(
|
||||||
SubredditRoomDatabase.getDatabase(this).subredditDao(), mPostData.getSubredditName(),
|
SubredditRoomDatabase.getDatabase(this).subredditDao(), mPostData.getSubredditNamePrefixed(),
|
||||||
new LoadSubredditIconAsyncTask.LoadSubredditIconAsyncTaskListener() {
|
new LoadSubredditIconAsyncTask.LoadSubredditIconAsyncTaskListener() {
|
||||||
@Override
|
@Override
|
||||||
public void loadIconSuccess(String iconImageUrl) {
|
public void loadIconSuccess(String iconImageUrl) {
|
||||||
@ -145,7 +145,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
mAcquireAccessTokenRequestQueue = Volley.newRequestQueue(this);
|
mAcquireAccessTokenRequestQueue = Volley.newRequestQueue(this);
|
||||||
mCommentQueue = Volley.newRequestQueue(this);
|
mCommentQueue = Volley.newRequestQueue(this);
|
||||||
|
|
||||||
subredditTextView.setText(mPostData.getSubredditName());
|
subredditTextView.setText(mPostData.getSubredditNamePrefixed());
|
||||||
postTimeTextView.setText(mPostData.getPostTime());
|
postTimeTextView.setText(mPostData.getPostTime());
|
||||||
|
|
||||||
if(mPostData.getGilded() > 0) {
|
if(mPostData.getGilded() > 0) {
|
||||||
@ -195,7 +195,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
Intent intent = new Intent(ViewPostDetailActivity.this, ViewImageActivity.class);
|
Intent intent = new Intent(ViewPostDetailActivity.this, ViewImageActivity.class);
|
||||||
intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPostData.getUrl());
|
intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPostData.getUrl());
|
||||||
intent.putExtra(ViewImageActivity.TITLE_KEY, mPostData.getTitle());
|
intent.putExtra(ViewImageActivity.TITLE_KEY, mPostData.getTitle());
|
||||||
intent.putExtra(ViewImageActivity.FILE_NAME_KEY, mPostData.getSubredditName().substring(2)
|
intent.putExtra(ViewImageActivity.FILE_NAME_KEY, mPostData.getSubredditNamePrefixed().substring(2)
|
||||||
+ "-" + mPostData.getId().substring(3));
|
+ "-" + mPostData.getId().substring(3));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
intent.putExtra(ViewVideoActivity.IS_DOWNLOADABLE_KEY, mPostData.isDownloadableGifOrVideo());
|
intent.putExtra(ViewVideoActivity.IS_DOWNLOADABLE_KEY, mPostData.isDownloadableGifOrVideo());
|
||||||
if(mPostData.isDownloadableGifOrVideo()) {
|
if(mPostData.isDownloadableGifOrVideo()) {
|
||||||
intent.putExtra(ViewVideoActivity.DOWNLOAD_URL_KEY, mPostData.getGifOrVideoDownloadUrl());
|
intent.putExtra(ViewVideoActivity.DOWNLOAD_URL_KEY, mPostData.getGifOrVideoDownloadUrl());
|
||||||
intent.putExtra(ViewVideoActivity.SUBREDDIT_KEY, mPostData.getSubredditName());
|
intent.putExtra(ViewVideoActivity.SUBREDDIT_KEY, mPostData.getSubredditNamePrefixed());
|
||||||
intent.putExtra(ViewVideoActivity.ID_KEY, mPostData.getId());
|
intent.putExtra(ViewVideoActivity.ID_KEY, mPostData.getId());
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
@ -301,7 +301,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
intent.putExtra(ViewVideoActivity.IS_DOWNLOADABLE_KEY, mPostData.isDownloadableGifOrVideo());
|
intent.putExtra(ViewVideoActivity.IS_DOWNLOADABLE_KEY, mPostData.isDownloadableGifOrVideo());
|
||||||
if(mPostData.isDownloadableGifOrVideo()) {
|
if(mPostData.isDownloadableGifOrVideo()) {
|
||||||
intent.putExtra(ViewVideoActivity.DOWNLOAD_URL_KEY, mPostData.getGifOrVideoDownloadUrl());
|
intent.putExtra(ViewVideoActivity.DOWNLOAD_URL_KEY, mPostData.getGifOrVideoDownloadUrl());
|
||||||
intent.putExtra(ViewVideoActivity.SUBREDDIT_KEY, mPostData.getSubredditName());
|
intent.putExtra(ViewVideoActivity.SUBREDDIT_KEY, mPostData.getSubredditNamePrefixed());
|
||||||
intent.putExtra(ViewVideoActivity.ID_KEY, mPostData.getId());
|
intent.putExtra(ViewVideoActivity.ID_KEY, mPostData.getId());
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
@ -494,7 +494,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
private void queryComment() {
|
private void queryComment() {
|
||||||
mCommentProgressbar.setVisibility(View.VISIBLE);
|
mCommentProgressbar.setVisibility(View.VISIBLE);
|
||||||
mNoCommentWrapperLinearLayout.setVisibility(View.GONE);
|
mNoCommentWrapperLinearLayout.setVisibility(View.GONE);
|
||||||
new FetchComment(mCommentQueue, mPostData.getSubredditName(), mPostData.getId()).queryComment(new FetchComment.FetchCommentListener() {
|
new FetchComment(mCommentQueue, mPostData.getSubredditNamePrefixed(), mPostData.getId()).queryComment(new FetchComment.FetchCommentListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFetchCommentSuccess(String response) {
|
public void onFetchCommentSuccess(String response) {
|
||||||
new ParseComment().parseComment(ViewPostDetailActivity.this, response, new ArrayList<CommentData>(), new ParseComment.ParseCommentListener() {
|
new ParseComment().parseComment(ViewPostDetailActivity.this, response, new ArrayList<CommentData>(), new ParseComment.ParseCommentListener() {
|
||||||
|
@ -40,7 +40,6 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
String id = getIntent().getExtras().getString(EXTRA_SUBREDDIT_ID);
|
|
||||||
final String subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
|
final String subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
|
||||||
|
|
||||||
final String title = "r/" + subredditName;
|
final String title = "r/" + subredditName;
|
||||||
@ -75,6 +74,7 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
final TextView descriptionTextView = findViewById(R.id.description_text_view_view_subreddit_detail_activity);
|
final TextView descriptionTextView = findViewById(R.id.description_text_view_view_subreddit_detail_activity);
|
||||||
final RequestManager glide = Glide.with(ViewSubredditDetailActivity.this);
|
final RequestManager glide = Glide.with(ViewSubredditDetailActivity.this);
|
||||||
|
|
||||||
|
String id = getIntent().getExtras().getString(EXTRA_SUBREDDIT_ID);
|
||||||
SubredditViewModel.Factory factory = new SubredditViewModel.Factory(getApplication(), id);
|
SubredditViewModel.Factory factory = new SubredditViewModel.Factory(getApplication(), id);
|
||||||
mSubredditViewModel = ViewModelProviders.of(this, factory).get(SubredditViewModel.class);
|
mSubredditViewModel = ViewModelProviders.of(this, factory).get(SubredditViewModel.class);
|
||||||
mSubredditViewModel.getSubredditLiveData().observe(this, new Observer<SubredditData>() {
|
mSubredditViewModel.getSubredditLiveData().observe(this, new Observer<SubredditData>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user