use of com.meisolsson.githubsdk.model.Milestone in project PocketHub by pockethub.
the class IssuesFragment method updateFilterSummary.
private void updateFilterSummary() {
if (filter.isOpen()) {
state.setText(R.string.open_issues);
} else {
state.setText(R.string.closed_issues);
}
Collection<Label> filterLabels = filter.getLabels();
if (filterLabels != null && !filterLabels.isEmpty()) {
LabelDrawableSpan.setText(labels, filterLabels);
labels.setVisibility(VISIBLE);
} else {
labels.setVisibility(GONE);
}
Milestone filterMilestone = filter.getMilestone();
if (filterMilestone != null) {
milestone.setText(filterMilestone.title());
milestone.setVisibility(VISIBLE);
} else {
milestone.setVisibility(GONE);
}
User user = filter.getAssignee();
if (user != null) {
avatars.bind(assigneeAvatar, user);
assignee.setText(user.login());
assigneeArea.setVisibility(VISIBLE);
} else {
assigneeArea.setVisibility(GONE);
}
}
use of com.meisolsson.githubsdk.model.Milestone in project PocketHub by pockethub.
the class MilestoneDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
Activity activity = getActivity();
Bundle arguments = getArguments();
final MaterialDialog.Builder dialogBuilder = createDialogBuilder().negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
MilestoneDialogFragment.this.onClick(dialog, BUTTON_NEGATIVE);
}
}).neutralText(R.string.clear).onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
MilestoneDialogFragment.this.onClick(dialog, BUTTON_NEUTRAL);
}
});
LayoutInflater inflater = activity.getLayoutInflater();
ListView view = (ListView) inflater.inflate(R.layout.dialog_list_view, null);
view.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
onClick(getDialog(), position);
}
});
ArrayList<Milestone> choices = getChoices();
int selected = arguments.getInt(ARG_SELECTED_CHOICE);
MilestoneListAdapter adapter = new MilestoneListAdapter(inflater, choices.toArray(new Milestone[choices.size()]), selected);
view.setAdapter(adapter);
if (selected >= 0) {
view.setSelection(selected);
}
dialogBuilder.customView(view, false);
return dialogBuilder.build();
}
use of com.meisolsson.githubsdk.model.Milestone in project PocketHub by pockethub.
the class EditIssueActivity method updateMilestone.
private void updateMilestone() {
Milestone milestone = issue.milestone();
if (milestone != null) {
milestoneText.setText(milestone.title());
float closed = milestone.closedIssues();
float total = closed + milestone.openIssues();
if (total > 0) {
((LayoutParams) milestoneClosed.getLayoutParams()).weight = closed / total;
milestoneClosed.setVisibility(VISIBLE);
} else {
milestoneClosed.setVisibility(GONE);
}
milestoneGraph.setVisibility(VISIBLE);
} else {
milestoneText.setText(R.string.none);
milestoneGraph.setVisibility(GONE);
}
}
use of com.meisolsson.githubsdk.model.Milestone in project PocketHub by pockethub.
the class FilterListAdapter method update.
@Override
protected void update(int position, IssueFilter filter) {
avatars.bind(imageView(0), filter.getRepository().owner());
setText(1, InfoUtils.createRepoId(filter.getRepository()));
if (filter.isOpen()) {
setText(2, R.string.open_issues);
} else {
setText(2, R.string.closed_issues);
}
Collection<Label> labels = filter.getLabels();
if (labels != null && !labels.isEmpty()) {
TextView labelsText = textView(3);
LabelDrawableSpan.setText(labelsText, labels);
ViewUtils.setGone(labelsText, false);
} else {
setGone(3, true);
}
Milestone milestone = filter.getMilestone();
if (milestone != null) {
ViewUtils.setGone(setText(4, milestone.title()), false);
} else {
setGone(4, true);
}
User assignee = filter.getAssignee();
if (assignee != null) {
avatars.bind(imageView(7), assignee);
ViewUtils.setGone(setText(6, assignee.login()), false);
} else {
setGone(5, true);
}
}
use of com.meisolsson.githubsdk.model.Milestone in project gh4a by slapperwan.
the class IssueEditActivity method showMilestonesDialog.
private void showMilestonesDialog() {
if (mAllMilestone == null) {
loadMilestones();
} else {
final String[] milestones = new String[mAllMilestone.size() + 1];
Milestone selectedMilestone = mEditIssue.milestone();
int selected = 0;
milestones[0] = getResources().getString(R.string.issue_clear_milestone);
for (int i = 1; i <= mAllMilestone.size(); i++) {
Milestone m = mAllMilestone.get(i - 1);
milestones[i] = m.title();
if (selectedMilestone != null && m.number().equals(selectedMilestone.number())) {
selected = i;
}
}
final DialogInterface.OnClickListener selectCb = (dialog, which) -> {
mEditIssue = mEditIssue.toBuilder().milestone(which == 0 ? null : mAllMilestone.get(which - 1)).build();
updateOptionViews();
dialog.dismiss();
};
new AlertDialog.Builder(this).setCancelable(true).setTitle(R.string.issue_milestone_hint).setSingleChoiceItems(milestones, selected, selectCb).setNegativeButton(R.string.cancel, null).setNeutralButton(R.string.issue_manage_milestones, (dialog, which) -> {
Intent intent = IssueMilestoneListActivity.makeIntent(IssueEditActivity.this, mRepoOwner, mRepoName, mEditIssue.pullRequest() != null);
startActivityForResult(intent, REQUEST_MANAGE_MILESTONES);
}).show();
}
}
Aggregations