mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-11 18:57:11 +01:00
Fixed a bug which causes the app crash when starting ViewImageActivity from ViewPostDetailActivity.
This commit is contained in:
parent
362634d1c7
commit
c0eaf2d3bb
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user