Open respective content when tap on repo info prs, watchers, forks, stargazers (#632)

Merge branch 'master' into open-repo-info-item

Open respective content when tap on repo info items, prs, watchers, forks, stargazers

Co-authored-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/632
This commit is contained in:
M M Arif 2020-08-06 17:19:37 +02:00
parent 96fad2d73e
commit b4b7981722
2 changed files with 33 additions and 1 deletions

View File

@ -84,6 +84,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
private String repositoryOwner;
private String repositoryName;
public static ViewPager mViewPager;
private int tabsCount;
@Override
@ -175,7 +176,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
}
ViewPager mViewPager = findViewById(R.id.container);
mViewPager = findViewById(R.id.container);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));

View File

@ -1,6 +1,7 @@
package org.mian.gitnex.fragments;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
@ -19,6 +20,10 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.activities.RepoForksActivity;
import org.mian.gitnex.activities.RepoStargazersActivity;
import org.mian.gitnex.activities.RepoWatchersActivity;
import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
@ -143,6 +148,9 @@ public class RepoInfoFragment extends Fragment {
repoFilenameExpandCollapse = v.findViewById(R.id.repoFilenameExpandCollapse);
fileContentsFrameHeader = v.findViewById(R.id.fileContentsFrameHeader);
fileContentsFrame = v.findViewById(R.id.fileContentsFrame);
LinearLayout repoMetaStarsFrame = v.findViewById(R.id.repoMetaStarsFrame);
LinearLayout repoMetaForksFrame = v.findViewById(R.id.repoMetaForksFrame);
LinearLayout repoMetaWatchersFrame = v.findViewById(R.id.repoMetaWatchersFrame);
repoMetaFrame.setVisibility(View.GONE);
@ -169,6 +177,29 @@ public class RepoInfoFragment extends Fragment {
}
});
repoMetaStarsFrame.setOnClickListener(metaStars -> {
Intent intent = new Intent(ctx, RepoStargazersActivity.class);
intent.putExtra("repoFullNameForStars", repoOwner + "/" + repoName);
ctx.startActivity(intent);
});
repoMetaForksFrame.setOnClickListener(metaForks -> {
Intent intent = new Intent(ctx, RepoForksActivity.class);
intent.putExtra("repoFullNameForForks", repoOwner + "/" + repoName);
ctx.startActivity(intent);
});
repoMetaWatchersFrame.setOnClickListener(metaWatchers -> {
Intent intent = new Intent(ctx, RepoWatchersActivity.class);
intent.putExtra("repoFullNameForWatchers", repoOwner + "/" + repoName);
ctx.startActivity(intent);
});
repoMetaPullRequestsFrame.setOnClickListener(metaPR -> RepoDetailActivity.mViewPager.setCurrentItem(3));
return v;
}