Search in sources :

Example 6 with IssueLabelService

use of com.meisolsson.githubsdk.service.issues.IssueLabelService in project gh4a by slapperwan.

the class IssueLabelListActivity method editLabel.

private void editLabel(IssueLabelAdapter.EditableLabel label) {
    Label oldLabel = label.base();
    String errorMessage = getString(R.string.issue_error_edit_label, oldLabel.name());
    IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
    Label newLabel = Label.builder().name(label.editedName).color(label.editedColor).build();
    service.editLabel(mRepoOwner, mRepoName, oldLabel.name(), newLabel).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.saving_msg, errorMessage)).subscribe(result -> {
        loadLabels(true);
        setResult(RESULT_OK);
    }, error -> handleActionFailure("Editing label failed", error));
}
Also used : Label(com.meisolsson.githubsdk.model.Label) IssueLabelService(com.meisolsson.githubsdk.service.issues.IssueLabelService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Aggregations

ApiHelpers (com.gh4a.utils.ApiHelpers)6 IssueLabelService (com.meisolsson.githubsdk.service.issues.IssueLabelService)6 Label (com.meisolsson.githubsdk.model.Label)5 Context (android.content.Context)3 Intent (android.content.Intent)3 Bundle (android.os.Bundle)3 Nullable (android.support.annotation.Nullable)3 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)3 FloatingActionButton (android.support.design.widget.FloatingActionButton)3 AlertDialog (android.support.v7.app.AlertDialog)3 View (android.view.View)3 Gh4Application (com.gh4a.Gh4Application)3 R (com.gh4a.R)3 ServiceFactory (com.gh4a.ServiceFactory)3 RxUtils (com.gh4a.utils.RxUtils)3 UiUtils (com.gh4a.utils.UiUtils)3 DialogInterface (android.content.DialogInterface)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Menu (android.view.Menu)2 MenuItem (android.view.MenuItem)2