Search in sources :

Example 36 with Repository

use of com.meisolsson.githubsdk.model.Repository in project PocketHub by pockethub.

the class RepositoryListFragment method onListItemLongClick.

@Override
public boolean onListItemLongClick(ListView list, View v, int position, long itemId) {
    if (!isUsable()) {
        return false;
    }
    final Repository repo = (Repository) list.getItemAtPosition(position);
    if (repo == null) {
        return false;
    }
    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()).title(InfoUtils.createRepoId(repo));
    final MaterialDialog[] dialogHolder = new MaterialDialog[1];
    View view = getActivity().getLayoutInflater().inflate(R.layout.repo_dialog, null);
    ViewFinder finder = new ViewFinder(view);
    final User owner = repo.owner();
    avatars.bind(finder.imageView(R.id.iv_owner_avatar), owner);
    finder.setText(R.id.tv_owner_name, getString(R.string.navigate_to_user, owner.login()));
    finder.onClick(R.id.ll_owner_area, new OnClickListener() {

        @Override
        public void onClick(View v) {
            dialogHolder[0].dismiss();
            viewUser(owner);
        }
    });
    if ((recentRepos != null) && (recentRepos.contains(repo))) {
        finder.find(R.id.divider).setVisibility(View.VISIBLE);
        finder.find(R.id.ll_recent_repo_area).setVisibility(View.VISIBLE);
        finder.onClick(R.id.ll_recent_repo_area, new OnClickListener() {

            @Override
            public void onClick(View v) {
                dialogHolder[0].dismiss();
                recentRepos.remove(repo);
                refresh();
            }
        });
    }
    builder.customView(view, false);
    MaterialDialog dialog = builder.build();
    dialogHolder[0] = dialog;
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
    return true;
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ViewFinder(com.github.kevinsawicki.wishlist.ViewFinder) User(com.meisolsson.githubsdk.model.User) OnClickListener(android.view.View.OnClickListener) View(android.view.View) ListView(android.widget.ListView)

Example 37 with Repository

use of com.meisolsson.githubsdk.model.Repository in project PocketHub by pockethub.

the class RepositoryListFragment method onListItemClick.

@Override
public void onListItemClick(ListView list, View v, int position, long id) {
    Repository repo = (Repository) list.getItemAtPosition(position);
    if (recentRepos != null) {
        recentRepos.add(repo);
    }
    startActivityForResult(RepositoryViewActivity.createIntent(repo), REPOSITORY_VIEW);
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository)

Example 38 with Repository

use of com.meisolsson.githubsdk.model.Repository in project PocketHub by pockethub.

the class UserRepositoryListFragment method onListItemClick.

@Override
public void onListItemClick(ListView list, View v, int position, long id) {
    Repository repo = (Repository) list.getItemAtPosition(position);
    startActivityForResult(RepositoryViewActivity.createIntent(repo), REPOSITORY_VIEW);
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository)

Example 39 with Repository

use of com.meisolsson.githubsdk.model.Repository in project PocketHub by pockethub.

the class CommitFileViewActivity method onCreateLoader.

@Override
public Loader<CharSequence> onCreateLoader(int loader, Bundle args) {
    final String raw = args.getString(ARG_TEXT);
    final Repository repo = args.getParcelable(ARG_REPO);
    return new MarkdownLoader(this, repo, raw, imageGetter, false);
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) MarkdownLoader(com.github.pockethub.android.ui.MarkdownLoader)

Example 40 with Repository

use of com.meisolsson.githubsdk.model.Repository in project PocketHub by pockethub.

the class IconAndViewTextManager method formatTeamAdd.

void formatTeamAdd(GitHubEvent event, StyledText main, StyledText details) {
    boldActor(main, event);
    main.append(" added ");
    TeamAddPayload payload = (TeamAddPayload) event.payload();
    Repository repo = payload.repository();
    String repoName = repo != null ? repo.name() : null;
    if (repoName != null) {
        main.bold(repoName);
    }
    main.append(" to team");
    Team team = payload.team();
    String teamName = team != null ? team.name() : null;
    if (teamName != null) {
        main.append(' ').bold(teamName);
    }
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) TeamAddPayload(com.meisolsson.githubsdk.model.payload.TeamAddPayload) Team(com.meisolsson.githubsdk.model.Team)

Aggregations

Repository (com.meisolsson.githubsdk.model.Repository)68 User (com.meisolsson.githubsdk.model.User)18 GitHubEvent (com.meisolsson.githubsdk.model.GitHubEvent)9 Issue (com.meisolsson.githubsdk.model.Issue)9 Intent (android.content.Intent)8 View (android.view.View)8 TextView (android.widget.TextView)6 Bundle (android.os.Bundle)5 ImageView (android.widget.ImageView)5 LayoutInflater (android.view.LayoutInflater)4 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)4 Test (org.junit.Test)4 Uri (android.net.Uri)3 Menu (android.view.Menu)3 ViewGroup (android.view.ViewGroup)3 LinearLayout (android.widget.LinearLayout)3 R (com.gh4a.R)3 RepositoryActivity (com.gh4a.activities.RepositoryActivity)3 UserActivity (com.gh4a.activities.UserActivity)3 ApiHelpers (com.gh4a.utils.ApiHelpers)3