diff options
author | Alex Ning <chineseperson5@gmail.com> | 2018-08-10 16:05:20 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2018-08-10 16:05:20 +0000 |
commit | c0eaf2d3bb599503d35753c69854d62275775f17 (patch) | |
tree | 83b2133b444f3da7439f9d8d557ee25f77d8fe63 /app/src | |
parent | 362634d1c7b81b13c9814c7dfdd6ed35612149d4 (diff) | |
download | infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.tar infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.tar.gz infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.tar.bz2 infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.tar.lz infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.tar.xz infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.tar.zst infinity-for-reddit-c0eaf2d3bb599503d35753c69854d62275775f17.zip |
Fixed a bug which causes the app crash when starting ViewImageActivity from ViewPostDetailActivity.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/BestPostRecyclerViewAdapter.java | 39 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java | 4 |
2 files changed, 3 insertions, 40 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BestPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BestPostRecyclerViewAdapter.java index ed3fd0dd..38838a00 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/BestPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BestPostRecyclerViewAdapter.java @@ -535,43 +535,4 @@ class BestPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.View } } } - - /*private static class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> { - private final WeakReference<Context> contextWeakReference; - private final WeakReference<CircleImageView> circleImageViewWeakReference; - - private SubredditDao subredditDao; - private String subredditName; - private String iconImageUrl; - - LoadSubredditIconAsyncTask(Context context, CircleImageView iconImageView, SubredditDao subredditDao, String subredditName) { - contextWeakReference = new WeakReference<>(context); - circleImageViewWeakReference = new WeakReference<>(iconImageView); - this.subredditDao = subredditDao; - this.subredditName = subredditName; - } - - @Override - protected Void doInBackground(Void... voids) { - if(subredditDao.getSubredditData(subredditName) != null) { - iconImageUrl = subredditDao.getSubredditData(subredditName).getIconUrl(); - } - return null; - } - - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - Context context = contextWeakReference.get(); - CircleImageView circleImageView = circleImageViewWeakReference.get(); - - if(context != null && circleImageView != null) { - if(iconImageUrl != null) { - Glide.with(context).load(iconImageUrl).into(circleImageView); - } else { - Glide.with(context).load(R.drawable.subreddit_default_icon).into(circleImageView); - } - } - } - }*/ } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java index c65d5ab8..3245ddf9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java @@ -141,8 +141,10 @@ public class ViewPostDetailActivity extends AppCompatActivity { @Override public void onClick(View view) { Intent intent = new Intent(ViewPostDetailActivity.this, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPostData.getPreviewUrl()); + intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPostData.getUrl()); intent.putExtra(ViewImageActivity.TITLE_KEY, mPostData.getTitle()); + intent.putExtra(ViewImageActivity.SUBREDDIT_KEY, mPostData.getSubredditName()); + intent.putExtra(ViewImageActivity.ID_KEY, mPostData.getId()); startActivity(intent); } }); |