Skip to content
Snippets Groups Projects
Commit dc5b8ac7 authored by John Carlson's avatar John Carlson
Browse files

Show the creator in the overview

parent ab4a2501
No related branches found
No related tags found
No related merge requests found
Pipeline #
Loading
Loading
@@ -19,6 +19,7 @@ import com.commit451.gitlab.event.ProjectReloadEvent;
import com.commit451.gitlab.model.api.Project;
import com.commit451.gitlab.model.api.RepositoryFile;
import com.commit451.gitlab.model.api.RepositoryTreeObject;
import com.commit451.gitlab.util.NavigationManager;
import com.commit451.gitlab.util.PicassoImageGetter;
import com.squareup.otto.Subscribe;
 
Loading
Loading
@@ -27,6 +28,7 @@ import java.util.List;
 
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import in.uncod.android.bypass.Bypass;
import retrofit.Callback;
import retrofit.Response;
Loading
Loading
@@ -40,6 +42,7 @@ public class OverviewFragment extends BaseFragment {
}
 
@Bind(R.id.swipe_layout) SwipeRefreshLayout mSwipeRefreshLayout;
@Bind(R.id.creator) TextView mCreatorView;
@Bind(R.id.star_count) TextView mStarCountView;
@Bind(R.id.forks_count) TextView mForksCountView;
@Bind(R.id.overview_text) TextView mOverviewVew;
Loading
Loading
@@ -49,6 +52,17 @@ public class OverviewFragment extends BaseFragment {
private EventReceiver mEventReceiver;
private Bypass mBypass;
 
@OnClick(R.id.creator)
void onCreatorClick() {
if (mProject != null) {
if (mProject.belongsToGroup()) {
NavigationManager.navigateToGroup(getActivity(), mProject.getNamespace().getId());
} else {
NavigationManager.navigateToUser(getActivity(), mProject.getOwner());
}
}
}
private final Callback<List<RepositoryTreeObject>> mFilesCallback = new Callback<List<RepositoryTreeObject>>() {
@Override
public void onResponse(Response<List<RepositoryTreeObject>> response, Retrofit retrofit) {
Loading
Loading
@@ -193,6 +207,11 @@ public class OverviewFragment extends BaseFragment {
}
 
private void bindProject(Project project) {
if (project.belongsToGroup()) {
mCreatorView.setText(String.format(getString(R.string.created_by), project.getNamespace().getName()));
} else {
mCreatorView.setText(String.format(getString(R.string.created_by), project.getOwner().getUsername()));
}
mStarCountView.setText(String.valueOf(project.getStarCount()));
mForksCountView.setText(String.valueOf(project.getForksCount()));
}
Loading
Loading
Loading
Loading
@@ -65,9 +65,13 @@ public class NavigationManager {
activity.startActivity(SearchActivity.newInstance(activity));
}
 
public static void navigateToUser(Activity activity, UserBasic user) {
navigateToUser(activity, null, user);
}
public static void navigateToUser(Activity activity, ImageView profileImage, UserBasic user) {
Intent intent = UserActivity.newInstance(activity, user);
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 && profileImage != null) {
ActivityOptionsCompat options = ActivityOptionsCompat.
makeSceneTransitionAnimation(activity, profileImage, activity.getString(R.string.transition_user));
activity.startActivity(intent, options.toBundle());
Loading
Loading
<?xml version="1.0" encoding="utf-8"?>
<com.commit451.gitlab.view.GitLabSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.commit451.gitlab.view.GitLabSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
Loading
Loading
@@ -15,6 +15,18 @@
android:layout_height="wrap_content"
android:orientation="vertical">
 
<com.devspark.robototextview.widget.RobotoTextView
android:id="@+id/creator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:textSize="14sp"
android:background="?attr/selectableItemBackground"
tools:text="Created by Commit451"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Loading
Loading
Loading
Loading
@@ -128,6 +128,7 @@
 
<!-- Overview -->
<string name="no_readme_found">No README found for project</string>
<string name="created_by">Created by %1$s</string>
<!-- Commits -->
<string name="no_commits_found">No commits found.</string>
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment