use of com.fastaccess.data.dao.LabelModel in project FastHub by k0shk0sh.
the class LabelsViewHolder method onClick.
@Override
public void onClick(View v) {
if (onSelectLabel != null) {
int position = getAdapterPosition();
if (adapter != null) {
LabelModel labelModel = (LabelModel) adapter.getItem(position);
onSelectLabel.onToggleSelection(labelModel, !onSelectLabel.isLabelSelected(labelModel));
}
} else {
super.onClick(v);
}
}
use of com.fastaccess.data.dao.LabelModel in project FastHub by k0shk0sh.
the class CreateLabelPresenter method onSubmitLabel.
@Override
public void onSubmitLabel(@NonNull String name, @NonNull String color, @NonNull String repo, @NonNull String login) {
LabelModel labelModel = new LabelModel();
labelModel.setColor(color.replaceAll("#", ""));
labelModel.setName(name);
makeRestCall(RestProvider.getRepoService(isEnterprise()).addLabel(login, repo, labelModel), labelModel1 -> sendToView(view -> view.onSuccessfullyCreated(labelModel1)));
}
use of com.fastaccess.data.dao.LabelModel in project FastHub by k0shk0sh.
the class CreateIssueActivity method onSelectedLabels.
@Override
public void onSelectedLabels(@NonNull ArrayList<LabelModel> labelModels) {
this.labelModels.clear();
this.labelModels.addAll(labelModels);
SpannableBuilder builder = SpannableBuilder.builder();
for (int i = 0; i < labelModels.size(); i++) {
LabelModel labelModel = labelModels.get(i);
int color = Color.parseColor("#" + labelModel.getColor());
if (i > 0) {
builder.append(" ").append(" " + labelModel.getName() + " ", new LabelSpan(color));
} else {
builder.append(labelModel.getName() + " ", new LabelSpan(color));
}
}
this.labels.setText(builder);
}
use of com.fastaccess.data.dao.LabelModel in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendIssueEvent.
private void appendIssueEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
Issue issue = eventsModel.getPayload().getIssue();
boolean isLabel = "label".equals(eventsModel.getPayload().getAction());
LabelModel label = isLabel ? issue.getLabels() != null && !issue.getLabels().isEmpty() ? issue.getLabels().get(issue.getLabels().size() - 1) : null : null;
spannableBuilder.bold(isLabel && label != null ? ("Labeled " + label.getName()) : eventsModel.getPayload().getAction()).append(" ").bold("issue").append(" ").append(eventsModel.getRepo().getName()).bold("#").bold(String.valueOf(issue.getNumber()));
if (issue.getTitle() != null) {
MarkDownProvider.stripMdText(description, issue.getTitle().replaceAll("\\r?\\n|\\r", " "));
description.setVisibility(View.VISIBLE);
} else {
description.setText("");
description.setVisibility(View.GONE);
}
}
Aggregations