diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index b0dfb6a7..40c66e59 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -16,6 +16,24 @@
+
+
+
+
diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java
index 7fb9c665..76c23b93 100644
--- a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java
@@ -33,7 +33,6 @@ import org.mian.gitnex.fragments.BottomSheetIssuesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetMilestonesFilterFragment;
import org.mian.gitnex.fragments.BottomSheetPullRequestFilterFragment;
import org.mian.gitnex.fragments.BottomSheetRepoFragment;
-import org.mian.gitnex.fragments.BranchesFragment;
import org.mian.gitnex.fragments.CollaboratorsFragment;
import org.mian.gitnex.fragments.FilesFragment;
import org.mian.gitnex.fragments.IssuesFragment;
@@ -163,7 +162,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
}
// Only show collaborators tab, if you have permission to
- View collaboratorTab = viewGroup.getChildAt(8);
+ View collaboratorTab = viewGroup.getChildAt(7);
if(tinyDB.getBoolean("isRepoAdmin") || new Version(tinyDB.getString("giteaVersion")).higherOrEqual("1.12.0")) {
@@ -229,8 +228,8 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
if(textViewBadgeRelease.getText() != "") { // only show if API returned a number
- Objects.requireNonNull(tabLayout.getTabAt(5)).setCustomView(tabHeader6);
- TabLayout.Tab tabOpenRelease = tabLayout.getTabAt(5);
+ Objects.requireNonNull(tabLayout.getTabAt(4)).setCustomView(tabHeader6);
+ TabLayout.Tab tabOpenRelease = tabLayout.getTabAt(4);
assert tabOpenRelease != null; // FIXME This should be cleaned up
TextView openReleaseTabView = Objects.requireNonNull(tabOpenRelease.getCustomView()).findViewById(R.id.counterBadgeReleaseText);
openReleaseTabView.setTextColor(textColor);
@@ -300,6 +299,12 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
chooseBranch();
return true;
+ case R.id.branchCommits:
+ Intent intent = new Intent(ctx, CommitsActivity.class);
+ intent.putExtra("branchName", tinyDB.getString("repoBranch"));
+ ctx.startActivity(intent);
+ return true;
+
default:
return super.onOptionsItemSelected(item);
@@ -490,20 +495,17 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
fragment = new PullRequestsFragment();
break;
- case 4: // Branches
- return BranchesFragment.newInstance(repositoryOwner, repositoryName);
-
- case 5: // Releases
+ case 4: // Releases
return ReleasesFragment.newInstance(repositoryOwner, repositoryName);
- case 6: // Milestones
+ case 5: // Milestones
fragment = new MilestonesFragment();
break;
- case 7: // Labels
+ case 6: // Labels
return LabelsFragment.newInstance(repositoryOwner, repositoryName);
- case 8: // Collaborators
+ case 7: // Collaborators
return CollaboratorsFragment.newInstance(repositoryOwner, repositoryName);
}
diff --git a/app/src/main/java/org/mian/gitnex/adapters/BranchesAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/BranchesAdapter.java
deleted file mode 100644
index 5311c7dd..00000000
--- a/app/src/main/java/org/mian/gitnex/adapters/BranchesAdapter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.mian.gitnex.adapters;
-
-import android.content.Context;
-import android.content.Intent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.TextView;
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-import org.mian.gitnex.R;
-import org.mian.gitnex.activities.CommitsActivity;
-import org.mian.gitnex.helpers.TinyDB;
-import org.mian.gitnex.models.Branches;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Author M M Arif
- */
-
-public class BranchesAdapter extends RecyclerView.Adapter {
-
- private List branchesList;
- private Context mCtx;
-
- static class BranchesViewHolder extends RecyclerView.ViewHolder {
-
- private TextView branchNameTv;
- private TextView branchCommitAuthor;
-
- private BranchesViewHolder(View itemView) {
- super(itemView);
-
- branchNameTv = itemView.findViewById(R.id.branchName);
- branchCommitAuthor = itemView.findViewById(R.id.branchCommitAuthor);
- Button branchCommitHash = itemView.findViewById(R.id.branchCommitHash);
-
- branchCommitHash.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
-
- Intent intent = new Intent(v.getContext(), CommitsActivity.class);
- intent.putExtra("branchName", String.valueOf(branchNameTv.getText()));
- Objects.requireNonNull(v.getContext()).startActivity(intent);
-
- }
- });
-
- }
- }
-
- public BranchesAdapter(Context mCtx, List branchesMain) {
- this.mCtx = mCtx;
- this.branchesList = branchesMain;
- }
-
- @NonNull
- @Override
- public BranchesAdapter.BranchesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_branches, parent, false);
- return new BranchesAdapter.BranchesViewHolder(v);
- }
-
- @Override
- public void onBindViewHolder(@NonNull BranchesAdapter.BranchesViewHolder holder, int position) {
-
- final TinyDB tinyDb = new TinyDB(mCtx);
- final String instanceUrl = tinyDb.getString("instanceUrl");
-
- Branches currentItem = branchesList.get(position);
- holder.branchNameTv.setText(currentItem.getName());
-
- if(currentItem.getCommit().getAuthor().getName() != null || !currentItem.getCommit().getAuthor().getName().equals("")) {
- holder.branchCommitAuthor.setText(mCtx.getResources().getString(R.string.commitAuthor, currentItem.getCommit().getAuthor().getName()));
- }
- else {
- holder.branchCommitAuthor.setText(mCtx.getResources().getString(R.string.commitAuthor, currentItem.getCommit().getAuthor().getUsername()));
- }
-
- }
-
- @Override
- public int getItemCount() {
- return branchesList.size();
- }
-
-}
-
-
diff --git a/app/src/main/java/org/mian/gitnex/fragments/BranchesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/BranchesFragment.java
deleted file mode 100644
index 1484a004..00000000
--- a/app/src/main/java/org/mian/gitnex/fragments/BranchesFragment.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package org.mian.gitnex.fragments;
-
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.lifecycle.Observer;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.recyclerview.widget.DividerItemDecoration;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-import org.mian.gitnex.R;
-import org.mian.gitnex.adapters.BranchesAdapter;
-import org.mian.gitnex.helpers.Authorization;
-import org.mian.gitnex.helpers.TinyDB;
-import org.mian.gitnex.models.Branches;
-import org.mian.gitnex.viewmodels.BranchesViewModel;
-import java.util.List;
-
-/**
- * Author M M Arif
- */
-
-public class BranchesFragment extends Fragment {
-
- private ProgressBar mProgressBar;
- private BranchesAdapter adapter;
- private RecyclerView mRecyclerView;
- private TextView noDataBranches;
- private static String repoNameF = "param2";
- private static String repoOwnerF = "param1";
-
- private String repoName;
- private String repoOwner;
-
- private OnFragmentInteractionListener mListener;
-
- public BranchesFragment() {
- }
-
- public static BranchesFragment newInstance(String param1, String param2) {
- BranchesFragment fragment = new BranchesFragment();
- Bundle args = new Bundle();
- args.putString(repoOwnerF, param1);
- args.putString(repoNameF, param2);
- fragment.setArguments(args);
- return fragment;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (getArguments() != null) {
- repoName = getArguments().getString(repoNameF);
- repoOwner = getArguments().getString(repoOwnerF);
- }
- }
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.fragment_branches, container, false);
-
- TinyDB tinyDb = new TinyDB(getContext());
- final String instanceUrl = tinyDb.getString("instanceUrl");
- final String loginUid = tinyDb.getString("loginUid");
- final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
- final String locale = tinyDb.getString("locale");
- final String timeFormat = tinyDb.getString("dateFormat");
- noDataBranches = v.findViewById(R.id.noDataBranches);
-
- final SwipeRefreshLayout swipeRefresh = v.findViewById(R.id.pullToRefresh);
-
- mRecyclerView = v.findViewById(R.id.recyclerView);
- mRecyclerView.setHasFixedSize(true);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
-
- DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
- DividerItemDecoration.VERTICAL);
- mRecyclerView.addItemDecoration(dividerItemDecoration);
-
- mProgressBar = v.findViewById(R.id.progress_bar);
-
- swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- swipeRefresh.setRefreshing(false);
- BranchesViewModel.loadBranchesList(instanceUrl, instanceToken, repoOwner, repoName, getContext());
- }
- }, 50);
- }
- });
-
- fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName);
-
- return v;
- }
-
- public void onButtonPressed(Uri uri) {
- if (mListener != null) {
- mListener.onFragmentInteraction(uri);
- }
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- mListener = null;
- }
-
- public interface OnFragmentInteractionListener {
- void onFragmentInteraction(Uri uri);
- }
-
- private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo) {
-
- BranchesViewModel branchesModel = new ViewModelProvider(this).get(BranchesViewModel.class);
-
- branchesModel.getBranchesList(instanceUrl, instanceToken, owner, repo, getContext()).observe(getViewLifecycleOwner(), new Observer>() {
- @Override
- public void onChanged(@Nullable List branchesListMain) {
- adapter = new BranchesAdapter(getContext(), branchesListMain);
- if(adapter.getItemCount() > 0) {
- mRecyclerView.setAdapter(adapter);
- noDataBranches.setVisibility(View.GONE);
- }
- else {
- adapter.notifyDataSetChanged();
- mRecyclerView.setAdapter(adapter);
- noDataBranches.setVisibility(View.VISIBLE);
- }
- mProgressBar.setVisibility(View.GONE);
- }
- });
-
- }
-
-}
diff --git a/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java b/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java
index 7c726bd0..986187e3 100644
--- a/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java
+++ b/app/src/main/java/org/mian/gitnex/fragments/FilesFragment.java
@@ -30,7 +30,6 @@ import org.mian.gitnex.helpers.TinyDB;
import org.mian.gitnex.viewmodels.FilesViewModel;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Objects;
import moe.feng.common.view.breadcrumbs.BreadcrumbsView;
import moe.feng.common.view.breadcrumbs.DefaultBreadcrumbsCallback;
import moe.feng.common.view.breadcrumbs.model.BreadcrumbItem;
@@ -111,7 +110,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
mBreadcrumbsView = v.findViewById(R.id.breadcrumbs_view);
mBreadcrumbsView.setItems(new ArrayList<>(Collections.singletonList(BreadcrumbItem.createSimpleItem(getResources().getString(R.string.filesBreadcrumbRoot) + getResources().getString(R.string.colonDivider) + ref))));
- ((RepoDetailActivity) Objects.requireNonNull(getActivity())).setFragmentRefreshListenerFiles(repoBranch -> {
+ ((RepoDetailActivity) requireActivity()).setFragmentRefreshListenerFiles(repoBranch -> {
fileStructure.setText("");
ref = repoBranch;
@@ -198,7 +197,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
intent.putExtra("singleFileName", fileName);
}
- Objects.requireNonNull(getContext()).startActivity(intent);
+ requireContext().startActivity(intent);
}
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo, String ref) {
@@ -263,6 +262,7 @@ public class FilesFragment extends Fragment implements FilesAdapter.FilesAdapter
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
+ menu.clear();
inflater.inflate(R.menu.search_menu, menu);
inflater.inflate(R.menu.files_switch_branches_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
diff --git a/app/src/main/res/drawable/ic_commit.xml b/app/src/main/res/drawable/ic_commit.xml
new file mode 100644
index 00000000..928d115e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_commit.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/shape_round_corners.xml b/app/src/main/res/drawable/shape_round_corners.xml
index 66348e8b..e24719e2 100644
--- a/app/src/main/res/drawable/shape_round_corners.xml
+++ b/app/src/main/res/drawable/shape_round_corners.xml
@@ -1,6 +1,7 @@
+
diff --git a/app/src/main/res/layout/activity_repo_detail.xml b/app/src/main/res/layout/activity_repo_detail.xml
index 20e62336..b9bfae2e 100644
--- a/app/src/main/res/layout/activity_repo_detail.xml
+++ b/app/src/main/res/layout/activity_repo_detail.xml
@@ -68,12 +68,6 @@
android:layout_height="wrap_content"
android:text="@string/tabPullRequests" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/list_branches.xml b/app/src/main/res/layout/list_branches.xml
deleted file mode 100644
index bcc380c0..00000000
--- a/app/src/main/res/layout/list_branches.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/menu/files_switch_branches_menu.xml b/app/src/main/res/menu/files_switch_branches_menu.xml
index 6a514052..b6b4a463 100644
--- a/app/src/main/res/menu/files_switch_branches_menu.xml
+++ b/app/src/main/res/menu/files_switch_branches_menu.xml
@@ -1,12 +1,39 @@
diff --git a/app/src/main/res/menu/repo_dotted_menu.xml b/app/src/main/res/menu/repo_dotted_menu.xml
index 7d2ad9f6..58c05531 100644
--- a/app/src/main/res/menu/repo_dotted_menu.xml
+++ b/app/src/main/res/menu/repo_dotted_menu.xml
@@ -9,4 +9,4 @@
android:orderInCategory="1"
app:showAsAction="ifRoom" />
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values-v23/themes.xml b/app/src/main/res/values-v23/themes.xml
index eebcf4cf..2f65c0fc 100644
--- a/app/src/main/res/values-v23/themes.xml
+++ b/app/src/main/res/values-v23/themes.xml
@@ -33,6 +33,8 @@
- @color/darkGreen
- @color/darkGreen
- @color/darkGreen
+ - @style/customOverflowButtonStyle
+ - @style/customOverflowMenuStyle
@@ -69,6 +71,8 @@
- @color/retroThemeColorPrimary
- @color/retroThemeColorPrimary
- @color/retroThemeColorPrimary
+ - @style/customOverflowButtonStyle
+ - @style/customOverflowMenuStyle
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 89938d0a..437868aa 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -579,7 +579,7 @@
Share Pull Request
Share Repository
Create Repository
- Branch Commits
+ Commits
Committed by %1$s
View Commits
Changelog
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index d58a6b13..f339932a 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -33,6 +33,8 @@
- @color/darkGreen
- @color/darkGreen
- @color/darkGreen
+ - @style/customOverflowButtonStyle
+ - @style/customOverflowMenuStyle
@@ -68,6 +70,8 @@
- @color/darkGreen
- @color/darkGreen
- @color/darkGreen
+ - @style/customOverflowButtonStyle
+ - @style/customOverflowMenuStyle
@@ -103,9 +107,21 @@
- @color/retroThemeColorPrimary
- @color/retroThemeColorPrimary
- @color/retroThemeColorPrimary
+ - @style/customOverflowButtonStyle
+ - @style/customOverflowMenuStyle
+
+
+
+