Fix deleted milestone crash in timeline view

This commit is contained in:
M M Arif
2023-02-02 23:08:00 +05:00
parent a4a9dbe212
commit 12cc6c1d64
2 changed files with 12 additions and 11 deletions

View File

@@ -12,6 +12,7 @@ import android.os.Handler;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ImageSpan;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -462,9 +463,9 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
this.issueComment = timelineComment;
if (timelineLastView) {
//if (timelineLastView) {
// timelineLine2.setVisibility(View.GONE);
}
//}
StringBuilder infoBuilder = null;
if (issueComment.getCreatedAt() != null) {
@@ -485,6 +486,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
.append(context.getString(R.string.modifiedText));
}
}
assert infoBuilder != null;
String info = infoBuilder.toString();
// label view in timeline
@@ -701,17 +703,15 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
issueComment.getMilestone().getTitle(),
info));
} else {
start.setText(
context.getString(
R.string.timelineMilestoneRemoved,
issueComment.getUser().getLogin(),
issueComment.getOldMilestone().getTitle(),
info));
timelineIcon.setColorFilter(
context.getResources().getColor(R.color.iconIssuePrClosedColor, null));
if (issueComment.getOldMilestone() != null) {
start.setText(context.getString(R.string.timelineMilestoneRemoved, issueComment.getUser().getLogin(), issueComment.getOldMilestone().getTitle(), info));
}
else {
start.setText(context.getString(R.string.timelineMilestoneDeleted, issueComment.getUser().getLogin(), info));
}
timelineIcon.setColorFilter(context.getResources().getColor(R.color.iconIssuePrClosedColor, null));
}
start.setTextSize(fontSize);
timelineIcon.setImageDrawable(
ContextCompat.getDrawable(context, R.drawable.ic_milestone));
timelineData.addView(start);

View File

@@ -814,6 +814,7 @@
<string name="timelineAssigneesAssigned">%1$s was assigned by %2$s %3$s</string>
<string name="timelineMilestoneAdded">%1$s added this to the %2$s milestone %3$s</string>
<string name="timelineMilestoneRemoved">%1$s removed this from the %2$s milestone %3$s</string>
<string name="timelineMilestoneDeleted">%1$s added this to a deleted milestone %2$s</string>
<string name="timelineStatusClosedIssue">%1$s closed this issue %2$s</string>
<string name="timelineStatusReopenedIssue">%1$s reopened this issue %2$s</string>
<string name="timelineStatusReopenedPr">%1$s reopened this pull request %2$s</string>