Search in sources :

Example 1 with Milestone

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);
    }
}
Also used : User(com.meisolsson.githubsdk.model.User) Milestone(com.meisolsson.githubsdk.model.Milestone) Label(com.meisolsson.githubsdk.model.Label)

Example 2 with Milestone

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();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) Milestone(com.meisolsson.githubsdk.model.Milestone) BaseActivity(com.github.pockethub.android.ui.BaseActivity) Activity(android.app.Activity) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) DialogAction(com.afollestad.materialdialogs.DialogAction) LayoutInflater(android.view.LayoutInflater)

Example 3 with Milestone

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);
    }
}
Also used : Milestone(com.meisolsson.githubsdk.model.Milestone)

Example 4 with Milestone

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);
    }
}
Also used : User(com.meisolsson.githubsdk.model.User) Milestone(com.meisolsson.githubsdk.model.Milestone) Label(com.meisolsson.githubsdk.model.Label) TextView(android.widget.TextView)

Example 5 with Milestone

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();
    }
}
Also used : 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) DialogInterface(android.content.DialogInterface) Milestone(com.meisolsson.githubsdk.model.Milestone) Intent(android.content.Intent)

Aggregations

Milestone (com.meisolsson.githubsdk.model.Milestone)8 User (com.meisolsson.githubsdk.model.User)6 Label (com.meisolsson.githubsdk.model.Label)5 Bundle (android.os.Bundle)3 TextView (android.widget.TextView)3 Intent (android.content.Intent)2 LayoutInflater (android.view.LayoutInflater)2 View (android.view.View)2 ApiHelpers (com.gh4a.utils.ApiHelpers)2 Activity (android.app.Activity)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Typeface (android.graphics.Typeface)1 IdRes (android.support.annotation.IdRes)1 Nullable (android.support.annotation.Nullable)1 AppBarLayout (android.support.design.widget.AppBarLayout)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 TextInputLayout (android.support.design.widget.TextInputLayout)1 ContextCompat (android.support.v4.content.ContextCompat)1