aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java34
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/events/PostUpdateEventToPostDetailFragment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/events/PostUpdateEventToDetailActivity.java)4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java4
4 files changed, 24 insertions, 23 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
index 41a09c37..48ae7d93 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
@@ -113,7 +113,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
private String mAccessToken;
private String mAccountName;
private long postFragmentId;
- private int postListPosition = -1;
+ private int postListPosition;
private int orientation;
private boolean mVolumeKeysNavigateComments;
private boolean isNsfwSubreddit;
@@ -172,6 +172,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
EventBus.getDefault().post(new NeedForPostListFromPostFragmentEvent(postFragmentId));
}
+ postListPosition = getIntent().getIntExtra(EXTRA_POST_LIST_POSITION, -1);
isNsfwSubreddit = getIntent().getBooleanExtra(EXTRA_IS_NSFW_SUBREDDIT, false);
fragmentManager = getSupportFragmentManager();
@@ -519,7 +520,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
bundle.putString(ViewPostDetailFragment.EXTRA_POST_ID, getIntent().getStringExtra(EXTRA_POST_ID));
} else {
bundle.putParcelable(ViewPostDetailFragment.EXTRA_POST_DATA, post);
- bundle.putInt(ViewPostDetailFragment.EXTRA_POST_LIST_POSITION, position);
+ bundle.putInt(ViewPostDetailFragment.EXTRA_POST_LIST_POSITION, postListPosition);
}
bundle.putString(ViewPostDetailFragment.EXTRA_SINGLE_COMMENT_ID, getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID));
bundle.putString(ViewPostDetailFragment.EXTRA_MESSAGE_FULLNAME, getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index 5e64c959..95be0ca5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -90,7 +90,7 @@ import ml.docilealligator.infinityforreddit.asynctasks.LoadUserData;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView;
-import ml.docilealligator.infinityforreddit.events.PostUpdateEventToDetailActivity;
+import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostDetailFragment;
import ml.docilealligator.infinityforreddit.fragments.PostFragment;
import ml.docilealligator.infinityforreddit.post.Post;
import ml.docilealligator.infinityforreddit.post.PostDataSource;
@@ -2393,7 +2393,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -2409,7 +2409,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
scoreTextView.setTextColor(previousScoreTextViewColor);
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
}
@@ -2489,7 +2489,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -2505,7 +2505,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
scoreTextView.setTextColor(previousScoreTextViewColor);
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
}
@@ -2534,7 +2534,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -2544,7 +2544,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
});
} else {
@@ -2558,7 +2558,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -2568,7 +2568,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
});
}
@@ -3371,7 +3371,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -3387,7 +3387,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
scoreTextView.setTextColor(previousScoreTextViewColor);
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
}
@@ -3468,7 +3468,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -3484,7 +3484,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
scoreTextView.setTextColor(previousScoreTextViewColor);
}
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
}, post.getFullName(), newVoteType, getBindingAdapterPosition());
}
@@ -3513,7 +3513,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -3523,7 +3523,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
});
} else {
@@ -3537,7 +3537,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
@Override
@@ -3547,7 +3547,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
- EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
+ EventBus.getDefault().post(new PostUpdateEventToPostDetailFragment(post));
}
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/PostUpdateEventToDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/PostUpdateEventToPostDetailFragment.java
index e629ea2b..3d601b9e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/events/PostUpdateEventToDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/events/PostUpdateEventToPostDetailFragment.java
@@ -2,10 +2,10 @@ package ml.docilealligator.infinityforreddit.events;
import ml.docilealligator.infinityforreddit.post.Post;
-public class PostUpdateEventToDetailActivity {
+public class PostUpdateEventToPostDetailFragment {
public final Post post;
- public PostUpdateEventToDetailActivity(Post post) {
+ public PostUpdateEventToPostDetailFragment(Post post) {
this.post = post;
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
index 86cc6c4a..6c960a2d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
@@ -89,7 +89,7 @@ import ml.docilealligator.infinityforreddit.events.ChangeNSFWBlurEvent;
import ml.docilealligator.infinityforreddit.events.ChangeNetworkStatusEvent;
import ml.docilealligator.infinityforreddit.events.ChangeSpoilerBlurEvent;
import ml.docilealligator.infinityforreddit.events.FlairSelectedEvent;
-import ml.docilealligator.infinityforreddit.events.PostUpdateEventToDetailActivity;
+import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostDetailFragment;
import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostList;
import ml.docilealligator.infinityforreddit.message.ReadMessage;
import ml.docilealligator.infinityforreddit.post.FetchPost;
@@ -1682,7 +1682,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
}
@Subscribe
- public void onPostUpdateEvent(PostUpdateEventToDetailActivity event) {
+ public void onPostUpdateEvent(PostUpdateEventToPostDetailFragment event) {
if (mPost.getId().equals(event.post.getId())) {
mPost.setVoteType(event.post.getVoteType());
mPost.setSaved(event.post.isSaved());