Merge pull request 'Minor improvement and fixes for repo info tab' (#382) from fixes-repo-info into master

Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/382
This commit is contained in:
M M Arif 2020-04-07 21:23:38 +00:00
commit 79944241fe
2 changed files with 32 additions and 28 deletions

View File

@ -263,47 +263,51 @@ public class RepoInfoFragment extends Fragment {
}
repoMetaForks.setText(repoInfo.getForks_count());
repoMetaSize.setText(AppUtil.formatFileSize(repoInfo.getSize()));
repoMetaWatchers.setText(repoInfo.getWatchers_count());
repoMetaCreatedAt.setText(TimeHelper.formatTime(repoInfo.getCreated_at(), new Locale(locale), timeFormat, ctx));
if(timeFormat.equals("pretty")) {
repoMetaCreatedAt.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(repoInfo.getCreated_at()), ctx));
}
if(repoInfo.getSize() != 0) {
repoMetaSize.setText(AppUtil.formatFileSize(repoInfo.getSize()));
}
else {
repoMetaSize.setText("0");
}
repoMetaCreatedAt.setText(TimeHelper.formatTime(repoInfo.getCreated_at(), new Locale(locale), timeFormat, ctx));
if(timeFormat.equals("pretty")) {
repoMetaCreatedAt.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(repoInfo.getCreated_at()), ctx));
}
String repoMetaUpdatedAt = TimeHelper.formatTime(repoInfo.getUpdated_at(), new Locale(locale), timeFormat, ctx);
String website = (repoInfo.getWebsite().isEmpty()) ? getResources().getString(R.string.noDataWebsite) : repoInfo.getWebsite();
repoMetaWebsite.setText(website);
repoAdditionalButton.setOnClickListener(new View.OnClickListener() {
repoAdditionalButton.setOnClickListener(v -> {
@Override
public void onClick(View v) {
StringBuilder message = new StringBuilder();
StringBuilder message = new StringBuilder();
message.append(getResources().getString(R.string.infoTabRepoDefaultBranch))
.append(" :\n").append(repoInfo.getDefault_branch()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoDefaultBranchText))
.append(":\n").append(repoInfo.getDefault_branch()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoUpdatedAt))
.append(" :\n").append(repoMetaUpdatedAt).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoUpdatedAt))
.append(":\n").append(repoInfo.getUpdated_at()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoSshUrl))
.append(" :\n").append(repoInfo.getSsh_url()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoSshUrl))
.append(":\n").append(repoInfo.getSsh_url()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoCloneUrl))
.append(" :\n").append(repoInfo.getClone_url()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoCloneUrl))
.append(":\n").append(repoInfo.getClone_url()).append("\n\n");
message.append(getResources().getString(R.string.infoTabRepoRepoUrl))
.append(" :\n").append(repoInfo.getHtml_url());
message.append(getResources().getString(R.string.infoTabRepoRepoUrl))
.append(":\n").append(repoInfo.getHtml_url());
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx);
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx);
alertDialog.setTitle(getResources().getString(R.string.infoMoreInformation));
alertDialog.setMessage(message);
alertDialog.setPositiveButton(getResources().getString(R.string.close), (dialog, which) -> dialog.dismiss());
alertDialog.create().show();
alertDialog.setTitle(getResources().getString(R.string.infoMoreInformation));
alertDialog.setMessage(message);
alertDialog.setPositiveButton(getResources().getString(R.string.close), (dialog, which) -> dialog.dismiss());
alertDialog.create().show();
}
});
if(repoInfo.getHas_issues() != null) {

View File

@ -23,7 +23,7 @@ public class UserRepositories {
private String html_url;
private String default_branch;
private Date created_at;
private String updated_at;
private Date updated_at;
private String clone_url;
private long size;
private String ssh_url;
@ -84,7 +84,7 @@ public class UserRepositories {
return created_at;
}
public String getUpdated_at() {
public Date getUpdated_at() {
return updated_at;
}