Search in sources :

Example 1 with CommentListAdapter

use of com.github.pockethub.android.ui.comment.CommentListAdapter in project PocketHub by pockethub.

the class IssueFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    list = finder.find(android.R.id.list);
    progress = finder.find(R.id.pb_loading);
    LayoutInflater inflater = getLayoutInflater(savedInstanceState);
    headerView = inflater.inflate(R.layout.issue_header, null);
    stateText = (TextView) headerView.findViewById(R.id.tv_state);
    titleText = (TextView) headerView.findViewById(R.id.tv_issue_title);
    authorText = (TextView) headerView.findViewById(R.id.tv_issue_author);
    createdDateText = (TextView) headerView.findViewById(R.id.tv_issue_creation_date);
    creatorAvatar = (ImageView) headerView.findViewById(R.id.iv_avatar);
    commitsView = (ViewGroup) headerView.findViewById(R.id.ll_issue_commits);
    assigneeText = (TextView) headerView.findViewById(R.id.tv_assignee_name);
    assigneeAvatar = (ImageView) headerView.findViewById(R.id.iv_assignee_avatar);
    labelsArea = (TextView) headerView.findViewById(R.id.tv_labels);
    milestoneArea = headerView.findViewById(R.id.ll_milestone);
    milestoneText = (TextView) headerView.findViewById(R.id.tv_milestone);
    milestoneProgressArea = headerView.findViewById(R.id.v_closed);
    bodyText = (TextView) headerView.findViewById(R.id.tv_issue_body);
    bodyText.setMovementMethod(SelectableLinkMovementMethod.getInstance());
    loadingView = inflater.inflate(R.layout.loading_item, null);
    footerView = inflater.inflate(R.layout.footer_separator, null);
    commitsView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (IssueUtils.isPullRequest(issue)) {
                openPullRequestCommits();
            }
        }
    });
    stateText.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (issue != null) {
                stateTask.confirm(IssueState.open.equals(issue.state()));
            }
        }
    });
    milestoneArea.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (issue != null && canWrite) {
                milestoneTask.prompt(issue.milestone());
            }
        }
    });
    headerView.findViewById(R.id.ll_assignee).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (issue != null && canWrite) {
                assigneeTask.prompt(issue.assignee());
            }
        }
    });
    labelsArea.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (issue != null && canWrite) {
                labelsTask.prompt(issue.labels());
            }
        }
    });
    Activity activity = getActivity();
    String userName = AccountUtils.getLogin(activity);
    adapter = new HeaderFooterListAdapter<>(list, new CommentListAdapter(activity.getLayoutInflater(), null, avatars, commentImageGetter, editCommentListener, deleteCommentListener, userName, canWrite, issue));
    list.setAdapter(adapter);
}
Also used : LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) BaseActivity(com.github.pockethub.android.ui.BaseActivity) CommitCompareViewActivity(com.github.pockethub.android.ui.commit.CommitCompareViewActivity) Activity(android.app.Activity) CommentListAdapter(com.github.pockethub.android.ui.comment.CommentListAdapter) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 2 with CommentListAdapter

use of com.github.pockethub.android.ui.comment.CommentListAdapter in project PocketHub by pockethub.

the class GistFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    list = finder.find(android.R.id.list);
    progress = finder.find(R.id.pb_loading);
    Activity activity = getActivity();
    User user = gist.owner();
    String userName = null;
    if (user != null) {
        userName = user.login();
    }
    adapter = new HeaderFooterListAdapter<>(list, new CommentListAdapter(activity.getLayoutInflater(), null, avatars, imageGetter, editCommentListener, deleteCommentListener, userName, isOwner(), null));
    list.setAdapter(adapter);
}
Also used : User(com.meisolsson.githubsdk.model.User) FragmentActivity(android.support.v4.app.FragmentActivity) Activity(android.app.Activity) CommentListAdapter(com.github.pockethub.android.ui.comment.CommentListAdapter)

Aggregations

Activity (android.app.Activity)2 CommentListAdapter (com.github.pockethub.android.ui.comment.CommentListAdapter)2 FragmentActivity (android.support.v4.app.FragmentActivity)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 BaseActivity (com.github.pockethub.android.ui.BaseActivity)1 CommitCompareViewActivity (com.github.pockethub.android.ui.commit.CommitCompareViewActivity)1 User (com.meisolsson.githubsdk.model.User)1