Permalink
Browse files

Open UserViewActivity on click to contributors list item

  • Loading branch information...
1 parent 719ebed commit b60bc6fd3d733a7ec5cf662fc2bb2017f8b7923b @atermenji committed Mar 31, 2013
Showing with 21 additions and 0 deletions.
  1. +21 −0 app/src/main/java/com/github/mobile/ui/repo/RepositoryContributorsFragment.java
@@ -19,18 +19,24 @@
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.content.Loader;
+import android.view.View;
+import android.widget.ListView;
import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
import com.github.mobile.R.string;
import com.github.mobile.ThrowableLoader;
+import com.github.mobile.accounts.AccountUtils;
+import com.github.mobile.core.user.RefreshUserTask;
import com.github.mobile.ui.ItemListFragment;
+import com.github.mobile.ui.user.UserViewActivity;
import com.github.mobile.util.AvatarLoader;
import com.google.inject.Inject;
import java.util.List;
import org.eclipse.egit.github.core.Contributor;
import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.service.RepositoryService;
/**
@@ -84,6 +90,21 @@ public void onActivityCreated(Bundle savedInstanceState) {
}
@Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+ final Contributor contributor = (Contributor) l.getItemAtPosition(position);
+ new RefreshUserTask(getActivity(), contributor.getLogin()) {
+
+ @Override
+ protected void onSuccess(User user) throws Exception {
+ super.onSuccess(user);
+
+ if (!AccountUtils.isUser(getActivity(), user))
+ startActivity(UserViewActivity.createIntent(user));
+ }
+ }.execute();
+ }
+
+ @Override
protected int getErrorMessage(Exception exception) {
return string.error_contributors_load;
}

0 comments on commit b60bc6f

Please sign in to comment.