Search in sources :

Example 1 with IssueMilestoneService

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

the class IssueListActivity method filterMilestone.

private void filterMilestone() {
    if (mMilestones != null) {
        showMilestonesDialog();
    } else {
        final IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
        registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryMilestones(mRepoOwner, mRepoName, "open", page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(milestones -> {
            mMilestones = milestones;
            showMilestonesDialog();
        }, this::handleLoadFailure));
    }
}
Also used : IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) Context(android.content.Context) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) Bundle(android.os.Bundle) SearchView(android.support.v7.widget.SearchView) IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) Intent(android.content.Intent) StringRes(android.support.annotation.StringRes) NonNull(android.support.annotation.NonNull) MenuItem(android.view.MenuItem) UiUtils(com.gh4a.utils.UiUtils) User(com.meisolsson.githubsdk.model.User) IssueListFragment(com.gh4a.fragment.IssueListFragment) IssueState(com.meisolsson.githubsdk.model.IssueState) Milestone(com.meisolsson.githubsdk.model.Milestone) Label(com.meisolsson.githubsdk.model.Label) Locale(java.util.Locale) Menu(android.view.Menu) R(com.gh4a.R) Issue(com.meisolsson.githubsdk.model.Issue) View(android.view.View) IssueAssigneeService(com.meisolsson.githubsdk.service.issues.IssueAssigneeService) DialogInterface(android.content.DialogInterface) FloatingActionButton(android.support.design.widget.FloatingActionButton) ApiHelpers(com.gh4a.utils.ApiHelpers) BaseFragmentPagerActivity(com.gh4a.BaseFragmentPagerActivity) Fragment(android.support.v4.app.Fragment) IssueLabelService(com.meisolsson.githubsdk.service.issues.IssueLabelService) TextUtils(android.text.TextUtils) LoadingListFragmentBase(com.gh4a.fragment.LoadingListFragmentBase) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) AlertDialog(android.support.v7.app.AlertDialog) RxUtils(com.gh4a.utils.RxUtils) Gh4Application(com.gh4a.Gh4Application) SingleFactory(com.gh4a.utils.SingleFactory) Nullable(android.support.annotation.Nullable) ServiceFactory(com.gh4a.ServiceFactory) Activity(android.app.Activity)

Example 2 with IssueMilestoneService

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

the class IssueMilestoneEditActivity method deleteMilestone.

private void deleteMilestone() {
    IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
    service.deleteMilestone(mRepoOwner, mRepoName, mMilestone.number()).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.deleting_msg, R.string.issue_error_delete_milestone)).subscribe(result -> {
        setResult(RESULT_OK);
        finish();
    }, error -> handleActionFailure("Deleting milestone failed", error));
}
Also used : IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) ApiHelpers(com.gh4a.utils.ApiHelpers)

Example 3 with IssueMilestoneService

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

the class IssueEditActivity method loadMilestones.

private void loadMilestones() {
    final IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
    registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryMilestones(mRepoOwner, mRepoName, "open", page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
        mAllMilestone = result;
        showMilestonesDialog();
    }, this::handleLoadFailure));
}
Also used : IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) HttpURLConnection(java.net.HttpURLConnection) Bundle(android.os.Bundle) ImageView(android.widget.ImageView) IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) TextInputLayout(android.support.design.widget.TextInputLayout) MarkdownPreviewWebView(com.gh4a.widget.MarkdownPreviewWebView) IssueState(com.meisolsson.githubsdk.model.IssueState) Label(com.meisolsson.githubsdk.model.Label) Locale(java.util.Locale) ContentType(com.meisolsson.githubsdk.model.ContentType) Issue(com.meisolsson.githubsdk.model.Issue) View(android.view.View) StringUtils(com.gh4a.utils.StringUtils) FloatingActionButton(android.support.design.widget.FloatingActionButton) ContextCompat(android.support.v4.content.ContextCompat) IssueLabelService(com.meisolsson.githubsdk.service.issues.IssueLabelService) ViewGroup(android.view.ViewGroup) RepositoryContentService(com.meisolsson.githubsdk.service.repositories.RepositoryContentService) List(java.util.List) TextView(android.widget.TextView) RxUtils(com.gh4a.utils.RxUtils) Optional(com.gh4a.utils.Optional) Nullable(android.support.annotation.Nullable) Typeface(android.graphics.Typeface) Context(android.content.Context) AppBarLayout(android.support.design.widget.AppBarLayout) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) MarkdownButtonsBar(com.gh4a.widget.MarkdownButtonsBar) BasePagerActivity(com.gh4a.BasePagerActivity) Intent(android.content.Intent) Response(retrofit2.Response) Single(io.reactivex.Single) UiUtils(com.gh4a.utils.UiUtils) ArrayList(java.util.ArrayList) User(com.meisolsson.githubsdk.model.User) AvatarHandler(com.gh4a.utils.AvatarHandler) Milestone(com.meisolsson.githubsdk.model.Milestone) Content(com.meisolsson.githubsdk.model.Content) R(com.gh4a.R) IssueRequest(com.meisolsson.githubsdk.model.request.issue.IssueRequest) IssueService(com.meisolsson.githubsdk.service.issues.IssueService) RepositoryCollaboratorService(com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService) DialogInterface(android.content.DialogInterface) ApiHelpers(com.gh4a.utils.ApiHelpers) LayoutInflater(android.view.LayoutInflater) PagerAdapter(android.support.v4.view.PagerAdapter) IdRes(android.support.annotation.IdRes) AlertDialog(android.support.v7.app.AlertDialog) Gh4Application(com.gh4a.Gh4Application) ObjectsCompat(android.support.v4.util.ObjectsCompat) SingleFactory(com.gh4a.utils.SingleFactory) ServiceFactory(com.gh4a.ServiceFactory) EditText(android.widget.EditText)

Example 4 with IssueMilestoneService

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

the class IssueMilestoneListFragment method onCreateDataSingle.

@Override
protected Single<List<Milestone>> onCreateDataSingle(boolean bypassCache) {
    final IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, bypassCache);
    String targetState = mShowClosed ? "closed" : "open";
    return ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryMilestones(mRepoOwner, mRepoName, targetState, page));
}
Also used : IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService)

Example 5 with IssueMilestoneService

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

the class IssueMilestoneEditActivity method setMilestoneState.

private void setMilestoneState(boolean open) {
    @StringRes int dialogMessageResId = open ? R.string.opening_msg : R.string.closing_msg;
    String errorMessage = getString(open ? R.string.issue_milestone_reopen_error : R.string.issue_milestone_close_error, mMilestone.title());
    IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
    CreateMilestone request = CreateMilestone.builder().state(open ? IssueState.Open : IssueState.Closed).build();
    service.editMilestone(mRepoOwner, mRepoName, mMilestone.id(), request).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, dialogMessageResId, errorMessage)).subscribe(result -> {
        mMilestone = result;
        updateHighlightColor();
        supportInvalidateOptionsMenu();
        setResult(RESULT_OK);
    }, error -> handleActionFailure("Updating milestone failed", error));
}
Also used : IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) StringRes(android.support.annotation.StringRes) CreateMilestone(com.meisolsson.githubsdk.model.request.issue.CreateMilestone) ApiHelpers(com.gh4a.utils.ApiHelpers)

Aggregations

IssueMilestoneService (com.meisolsson.githubsdk.service.issues.IssueMilestoneService)6 ApiHelpers (com.gh4a.utils.ApiHelpers)5 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 Intent (android.content.Intent)2 Bundle (android.os.Bundle)2 Nullable (android.support.annotation.Nullable)2 StringRes (android.support.annotation.StringRes)2 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)2 AlertDialog (android.support.v7.app.AlertDialog)2 View (android.view.View)2 Gh4Application (com.gh4a.Gh4Application)2 R (com.gh4a.R)2 ServiceFactory (com.gh4a.ServiceFactory)2 RxUtils (com.gh4a.utils.RxUtils)2 SingleFactory (com.gh4a.utils.SingleFactory)2 UiUtils (com.gh4a.utils.UiUtils)2 Issue (com.meisolsson.githubsdk.model.Issue)2 IssueState (com.meisolsson.githubsdk.model.IssueState)2