FIX IssueComments moddel (#425)
Reformat Code FIX IssueComments moddel reformate Code TimeHelper.formatTime dont crash on null date object Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/425 Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
parent
0c6c596208
commit
aa85b99e84
@ -262,7 +262,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.issueCommentDate.setText(TimeHelper.formatTime(currentItem.getCreated_date(), new Locale(locale), timeFormat, mCtx));
|
holder.issueCommentDate.setText(TimeHelper.formatTime(currentItem.getCreated_at(), new Locale(locale), timeFormat, mCtx));
|
||||||
|
|
||||||
if(timeFormat.equals("pretty")) {
|
if(timeFormat.equals("pretty")) {
|
||||||
holder.issueCommentDate.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(currentItem.getCreated_at()), mCtx));
|
holder.issueCommentDate.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(currentItem.getCreated_at()), mCtx));
|
||||||
|
@ -24,7 +24,8 @@ public class TimeHelper {
|
|||||||
Date createdTime = null;
|
Date createdTime = null;
|
||||||
try {
|
try {
|
||||||
createdTime = formatter.parse(part1);
|
createdTime = formatter.parse(part1);
|
||||||
} catch (ParseException e) {
|
}
|
||||||
|
catch(ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +36,10 @@ public class TimeHelper {
|
|||||||
|
|
||||||
public static String formatTime(Date date, Locale locale, String timeFormat, Context context) {
|
public static String formatTime(Date date, Locale locale, String timeFormat, Context context) {
|
||||||
|
|
||||||
|
if(date == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
switch(timeFormat) {
|
switch(timeFormat) {
|
||||||
|
|
||||||
case "pretty": {
|
case "pretty": {
|
||||||
|
@ -14,12 +14,12 @@ public class IssueComments {
|
|||||||
private String issue_url;
|
private String issue_url;
|
||||||
private String body;
|
private String body;
|
||||||
private Date created_at;
|
private Date created_at;
|
||||||
private Date created_date;
|
|
||||||
private Date updated_at;
|
private Date updated_at;
|
||||||
|
|
||||||
private userObject user;
|
private userObject user;
|
||||||
|
|
||||||
public IssueComments(String body) {
|
public IssueComments(String body) {
|
||||||
|
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,68 +34,80 @@ public class IssueComments {
|
|||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLogin() {
|
public String getLogin() {
|
||||||
|
|
||||||
return login;
|
return login;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFull_name() {
|
public String getFull_name() {
|
||||||
|
|
||||||
return full_name;
|
return full_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
|
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAvatar_url() {
|
public String getAvatar_url() {
|
||||||
|
|
||||||
return avatar_url;
|
return avatar_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
|
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
|
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHtml_url() {
|
public String getHtml_url() {
|
||||||
|
|
||||||
return html_url;
|
return html_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPull_request_url() {
|
public String getPull_request_url() {
|
||||||
|
|
||||||
return pull_request_url;
|
return pull_request_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIssue_url() {
|
public String getIssue_url() {
|
||||||
|
|
||||||
return issue_url;
|
return issue_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBody() {
|
public String getBody() {
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated_at() {
|
public Date getCreated_at() {
|
||||||
|
|
||||||
return created_at;
|
return created_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreated_date() {
|
|
||||||
return created_date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public userObject getUser() {
|
public userObject getUser() {
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdated_at() {
|
public Date getUpdated_at() {
|
||||||
|
|
||||||
return updated_at;
|
return updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user