[PR #1] feat(repo): expose Commits as a top-level tab #1

Open
opened 2026-07-23 13:13:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/gitnex-org/gitnex/pull/1
Author: @a19q3
Created: 7/17/2026
Status: 🔄 Open

Base: main ← Head: feat/repo-commits-tab


📝 Commits (1)

  • f49a16b feat(repo): expose Commits as a top-level tab

📊 Changes

4 files changed (+332 additions, -9 deletions)

View changed files

📝 app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java (+25 -9)
➕ app/src/main/java/org/mian/gitnex/fragments/CommitsFragment.java (+229 -0)
📝 app/src/main/res/layout/activity_repo_detail.xml (+7 -0)
➕ app/src/main/res/layout/fragment_commits.xml (+71 -0)

📄 Description

Summary

The Commits view in the repository detail screen is currently hidden two layers deep: Files tab -> hub menu -> "Commits". Most users never find it. This PR promotes Commits to a peer tab between Files and Issues in the docked tab bar so it is discoverable alongside the other top-level sections.

What's changed

  • activity_repo_detail.xml — new btn_nav_commits MaterialButton (ic_commit icon) inserted between btn_nav_files and btn_nav_issues.
  • RepoDetailActivity.java
    • New TAG_COMMITS constant and additions to fragmentTags[] / buttonIds[].
    • setupFragments() adds a CommitsFragment instance with TAG_COMMITS to the container.
    • setupDockListeners() includes binding.btnNavCommits in the MaterialButton[] navButtons array and wires its OnClickListener to switchTab(TAG_COMMITS, …).
    • updateDockUI() includes R.id.btn_nav_commits in the allButtons array.
    • applyRepositoryFeatures() gates the new tab on repo.isHasCode() (hidden on wiki-only repos, same rule as the Files tab).
    • onGlobalRefresh() also dispatches to the new fragment.
  • New CommitsFragment.java + fragment_commits.xml — reuses the existing CommitsViewModel and CommitsAdapter; click still navigates to the existing CommitDetailActivity via the existing diff pipeline. Branch label is shown above the list (read-only, no switcher yet).
  • Builds clean: ./gradlew assembleFreeDebug and ./gradlew assembleProDebug both pass.

Out of scope (deliberately)

  • Branch switcher inside the Commits tab — deferred to a follow-up; the tab always reflects the currently selected RepositoryContext.branchRef, which is already mutable from elsewhere (Files, etc.).
  • Local search inside the tab — deferred to a follow-up; the existing CommitsActivity already has a search view, so adding it here is purely a port.

Both can land as a second PR on top of this one to keep this change small and reviewable.

Test plan

  • Open a repo with code (e.g. gitnex-org/gitnex itself).
  • Verify the dock now shows: Details | Files | Commits | Issues | ….
  • Tap Commits — list loads with infinite scroll, pull-to-refresh, and click navigates to CommitDetailActivity.
  • Switch branches from Files tab — re-open Commits tab — list reflects the new branch.
  • Open a wiki-only repo (or a repo with has_code = false) — Commits tab is hidden, no crash.
  • Open the hub menu on the Commits tab — the single COMMITS_OPEN_FULL entry is shown (no-op for now; kept as the seam for the follow-up branch-switcher / search work).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/gitnex-org/gitnex/pull/1 **Author:** [@a19q3](https://github.com/a19q3) **Created:** 7/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/repo-commits-tab` --- ### 📝 Commits (1) - [`f49a16b`](https://github.com/gitnex-org/gitnex/commit/f49a16b72d17e7c160b0c6dc41add43a468ada45) feat(repo): expose Commits as a top-level tab ### 📊 Changes **4 files changed** (+332 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java` (+25 -9) ➕ `app/src/main/java/org/mian/gitnex/fragments/CommitsFragment.java` (+229 -0) 📝 `app/src/main/res/layout/activity_repo_detail.xml` (+7 -0) ➕ `app/src/main/res/layout/fragment_commits.xml` (+71 -0) </details> ### 📄 Description ## Summary The **Commits** view in the repository detail screen is currently hidden two layers deep: `Files tab -> hub menu -> "Commits"`. Most users never find it. This PR promotes Commits to a peer tab between **Files** and **Issues** in the docked tab bar so it is discoverable alongside the other top-level sections. ## What's changed - **`activity_repo_detail.xml`** — new `btn_nav_commits` `MaterialButton` (`ic_commit` icon) inserted between `btn_nav_files` and `btn_nav_issues`. - **`RepoDetailActivity.java`** - New `TAG_COMMITS` constant and additions to `fragmentTags[]` / `buttonIds[]`. - `setupFragments()` adds a `CommitsFragment` instance with `TAG_COMMITS` to the container. - `setupDockListeners()` includes `binding.btnNavCommits` in the `MaterialButton[] navButtons` array and wires its `OnClickListener` to `switchTab(TAG_COMMITS, …)`. - `updateDockUI()` includes `R.id.btn_nav_commits` in the `allButtons` array. - `applyRepositoryFeatures()` gates the new tab on `repo.isHasCode()` (hidden on wiki-only repos, same rule as the Files tab). - `onGlobalRefresh()` also dispatches to the new fragment. - **New `CommitsFragment.java`** + **`fragment_commits.xml`** — reuses the existing `CommitsViewModel` and `CommitsAdapter`; click still navigates to the existing `CommitDetailActivity` via the existing diff pipeline. Branch label is shown above the list (read-only, no switcher yet). - Builds clean: `./gradlew assembleFreeDebug` and `./gradlew assembleProDebug` both pass. ## Out of scope (deliberately) - **Branch switcher inside the Commits tab** — deferred to a follow-up; the tab always reflects the currently selected `RepositoryContext.branchRef`, which is already mutable from elsewhere (Files, etc.). - **Local search inside the tab** — deferred to a follow-up; the existing `CommitsActivity` already has a search view, so adding it here is purely a port. Both can land as a second PR on top of this one to keep this change small and reviewable. ## Test plan - Open a repo with code (e.g. `gitnex-org/gitnex` itself). - Verify the dock now shows: **Details | Files | Commits | Issues | …**. - Tap **Commits** — list loads with infinite scroll, pull-to-refresh, and click navigates to `CommitDetailActivity`. - Switch branches from Files tab — re-open Commits tab — list reflects the new branch. - Open a wiki-only repo (or a repo with `has_code = false`) — Commits tab is hidden, no crash. - Open the hub menu on the Commits tab — the single `COMMITS_OPEN_FULL` entry is shown (no-op for now; kept as the seam for the follow-up branch-switcher / search work). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-23 13:13:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitnex#1