Skip to content

Commit

Permalink
Rename PullRequestFragment to PullRequestConversationFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
Fs00 authored and maniac103 committed Sep 10, 2021
1 parent 256692e commit 2baf3e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions app/src/main/java/com/gh4a/activities/PullRequestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import com.gh4a.fragment.CommitCompareFragment;
import com.gh4a.fragment.ConfirmationDialogFragment;
import com.gh4a.fragment.PullRequestFilesFragment;
import com.gh4a.fragment.PullRequestFragment;
import com.gh4a.fragment.PullRequestConversationFragment;
import com.gh4a.utils.ApiHelpers;
import com.gh4a.utils.IntentUtils;
import com.gh4a.utils.RxUtils;
Expand Down Expand Up @@ -118,7 +118,7 @@ public static Intent makeIntent(Context context, String repoOwner, String repoNa

private Issue mIssue;
private PullRequest mPullRequest;
private PullRequestFragment mPullRequestFragment;
private PullRequestConversationFragment mConversationFragment;
private IssueStateTrackingFloatingActionButton mEditFab;
private Review mPendingReview;
private boolean mPendingReviewLoaded;
Expand All @@ -129,8 +129,8 @@ public static Intent makeIntent(Context context, String repoOwner, String repoNa
private final ActivityResultLauncher<Intent> mCreateReviewLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultHelpers.ActivityResultSuccessCallback(() -> {
if (mPullRequestFragment != null) {
mPullRequestFragment.reloadEvents(false);
if (mConversationFragment != null) {
mConversationFragment.reloadEvents(false);
}
loadPendingReview(true);
})
Expand Down Expand Up @@ -295,16 +295,16 @@ protected int[] getHeaderColorAttrs() {

@Override
protected Fragment makeFragment(int position) {
if (position == 1) {
if (position == PAGE_COMMITS) {
PullRequestMarker base = mPullRequest.base();
PullRequestMarker head = mPullRequest.head();
return CommitCompareFragment.newInstance(mRepoOwner, mRepoName, mPullRequestNumber,
base.label(), base.sha(), head.label(), head.sha());
} else if (position == 2) {
} else if (position == PAGE_FILES) {
return PullRequestFilesFragment.newInstance(mRepoOwner, mRepoName,
mPullRequestNumber, mPullRequest.head().sha());
} else {
Fragment f = PullRequestFragment.newInstance(mPullRequest,
Fragment f = PullRequestConversationFragment.newInstance(mPullRequest,
mIssue, mIsCollaborator, mInitialComment);
mInitialComment = null;
return f;
Expand All @@ -313,15 +313,15 @@ protected Fragment makeFragment(int position) {

@Override
protected void onFragmentInstantiated(Fragment f, int position) {
if (position == 0) {
mPullRequestFragment = (PullRequestFragment) f;
if (position == PAGE_CONVERSATION) {
mConversationFragment = (PullRequestConversationFragment) f;
}
}

@Override
protected void onFragmentDestroyed(Fragment f) {
if (f == mPullRequestFragment) {
mPullRequestFragment = null;
if (f == mConversationFragment) {
mConversationFragment = null;
}
}

Expand All @@ -337,8 +337,8 @@ protected Intent navigateUp() {

@Override
public void onCommentsUpdated() {
if (mPullRequestFragment != null) {
mPullRequestFragment.reloadEvents(true);
if (mConversationFragment != null) {
mConversationFragment.reloadEvents(true);
}
}

Expand Down Expand Up @@ -433,8 +433,8 @@ private void fillHeader() {
}

private void handlePullRequestUpdate() {
if (mPullRequestFragment != null) {
mPullRequestFragment.updateState(mPullRequest);
if (mConversationFragment != null) {
mConversationFragment.updateState(mPullRequest);
}
if (mIssue != null) {
Issue.Builder builder = mIssue.toBuilder().state(mPullRequest.state());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@
import io.reactivex.schedulers.Schedulers;
import retrofit2.Response;

public class PullRequestFragment extends IssueFragmentBase {
public class PullRequestConversationFragment extends IssueFragmentBase {
private static final int ID_LOADER_STATUS = 1;
private static final int ID_LOADER_HEAD_REF = 2;

private PullRequest mPullRequest;
private GitReference mHeadReference;
private boolean mHasLoadedHeadReference;

public static PullRequestFragment newInstance(PullRequest pr, Issue issue,
public static PullRequestConversationFragment newInstance(PullRequest pr, Issue issue,
boolean isCollaborator, IntentUtils.InitialCommentMarker initialComment) {
PullRequestFragment f = new PullRequestFragment();
PullRequestConversationFragment f = new PullRequestConversationFragment();

Repository repo = pr.base().repo();
Bundle args = buildArgs(repo.owner().login(), repo.name(),
Expand Down

0 comments on commit 2baf3e9

Please sign in to comment.