mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-03-22 21:13:45 -05:00
Improve PR timeline UI
This commit is contained in:
@@ -92,7 +92,6 @@ import org.mian.gitnex.databinding.BottomSheetAttachmentsBinding;
|
||||
import org.mian.gitnex.databinding.CustomAssigneesSelectionDialogBinding;
|
||||
import org.mian.gitnex.databinding.CustomImageViewDialogBinding;
|
||||
import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding;
|
||||
import org.mian.gitnex.databinding.CustomPrInfoDialogBinding;
|
||||
import org.mian.gitnex.fragments.BottomSheetSingleIssueFragment;
|
||||
import org.mian.gitnex.fragments.IssuesFragment;
|
||||
import org.mian.gitnex.fragments.PullRequestsFragment;
|
||||
@@ -879,12 +878,7 @@ public class IssueDetailActivity extends BaseActivity
|
||||
showMenu =
|
||||
() -> {
|
||||
inflater.inflate(R.menu.generic_nav_dotted_menu, menu);
|
||||
if (issue.getIssueType() != null) {
|
||||
if (issue.getIssueType().equalsIgnoreCase("pull")) {
|
||||
inflater.inflate(R.menu.pr_info_menu, menu);
|
||||
}
|
||||
}
|
||||
showMenu = () -> {}; // reset Runnable
|
||||
showMenu = () -> {};
|
||||
};
|
||||
updateMenuState();
|
||||
return true;
|
||||
@@ -915,28 +909,6 @@ public class IssueDetailActivity extends BaseActivity
|
||||
bottomSheet.show(getSupportFragmentManager(), "singleIssueBottomSheet");
|
||||
}
|
||||
return true;
|
||||
} else if (id == R.id.prInfo) {
|
||||
|
||||
if (issue.getPullRequest() != null) {
|
||||
|
||||
MaterialAlertDialogBuilder materialAlertDialogBuilderPrInfo =
|
||||
new MaterialAlertDialogBuilder(ctx);
|
||||
CustomPrInfoDialogBinding customPrInfoDialogBinding =
|
||||
CustomPrInfoDialogBinding.inflate(LayoutInflater.from(ctx));
|
||||
View view = customPrInfoDialogBinding.getRoot();
|
||||
materialAlertDialogBuilderPrInfo.setView(view);
|
||||
|
||||
customPrInfoDialogBinding.baseBranch.setText(
|
||||
issue.getPullRequest().getBase().getRef());
|
||||
customPrInfoDialogBinding.headBranch.setText(
|
||||
issue.getPullRequest().getHead().getRef());
|
||||
|
||||
materialAlertDialogBuilderPrInfo.setTitle(
|
||||
getResources().getString(R.string.prMergeInfo));
|
||||
materialAlertDialogBuilderPrInfo.setNeutralButton(getString(R.string.close), null);
|
||||
materialAlertDialogBuilderPrInfo.create().show();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
@@ -990,8 +962,6 @@ public class IssueDetailActivity extends BaseActivity
|
||||
500);
|
||||
}
|
||||
|
||||
// tinyDB.remove("commentId");
|
||||
// tinyDB.remove("commentAction");
|
||||
mode = Mode.SEND;
|
||||
}
|
||||
|
||||
@@ -1130,6 +1100,21 @@ public class IssueDetailActivity extends BaseActivity
|
||||
|
||||
getStatuses();
|
||||
getPullRequest();
|
||||
|
||||
viewBinding.prInfoLayout.setVisibility(View.VISIBLE);
|
||||
String displayName;
|
||||
if (!issue.getPullRequest().getUser().getFullName().isEmpty()) {
|
||||
displayName = issue.getPullRequest().getUser().getFullName();
|
||||
} else {
|
||||
displayName = issue.getPullRequest().getUser().getLogin();
|
||||
}
|
||||
viewBinding.prInfo.setText(
|
||||
getString(
|
||||
R.string.pr_info,
|
||||
displayName,
|
||||
issue.getPullRequest().getHead().getRef(),
|
||||
issue.getPullRequest().getBase().getRef()));
|
||||
|
||||
if (issue.getIssue().getPullRequest().isMerged()) { // merged
|
||||
|
||||
viewBinding.issuePrState.setImageResource(R.drawable.ic_pull_request);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
private final IssueContext issue;
|
||||
private List<TimelineComment> issuesComments;
|
||||
private OnLoadMoreListener loadMoreListener;
|
||||
private boolean isLoading = false, isMoreDataAvailable = true, timelineLastView = false;
|
||||
private boolean isLoading = false, isMoreDataAvailable = true;
|
||||
private Intent intent;
|
||||
|
||||
public IssueCommentsAdapter(
|
||||
@@ -181,7 +181,6 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
&& loadMoreListener != null) {
|
||||
isLoading = true;
|
||||
loadMoreListener.onLoadMore();
|
||||
timelineLastView = true;
|
||||
}
|
||||
|
||||
((IssueCommentsAdapter.IssueCommentViewHolder) holder)
|
||||
@@ -477,9 +476,17 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||
|
||||
this.issueComment = timelineComment;
|
||||
|
||||
// if (timelineLastView) {
|
||||
// timelineLine2.setVisibility(View.GONE);
|
||||
// }
|
||||
/*if (getBindingAdapterPosition() == 0) {
|
||||
timelineDividerView.setVisibility(View.GONE);
|
||||
} else {
|
||||
timelineDividerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (getBindingAdapterPosition() == getItemCount() - 1) {
|
||||
timelineLine2.setVisibility(View.GONE);
|
||||
} else {
|
||||
timelineLine2.setVisibility(View.VISIBLE);
|
||||
}*/
|
||||
|
||||
StringBuilder infoBuilder = null;
|
||||
if (issueComment.getCreatedAt() != null) {
|
||||
|
||||
@@ -413,10 +413,80 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/pr_info_layout"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/mainThreadCard"
|
||||
android:layout_marginTop="@dimen/dimen12dp"
|
||||
android:visibility="gone"
|
||||
app:cardElevation="@dimen/dimen0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/materialCardBackgroundColor"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/dimen12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pr_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textIsSelectable="true"
|
||||
android:text="@string/pr_info"
|
||||
android:textSize="@dimen/dimen14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/notes_info_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/pr_info_layout"
|
||||
android:layout_marginTop="@dimen/dimen16dp">
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen2dp"
|
||||
app:dividerColor="?attr/dividerColor"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_centerInParent="true"
|
||||
app:cardCornerRadius="@dimen/dimen10dp"
|
||||
app:cardElevation="@dimen/dimen0dp">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/divider_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/timeline"
|
||||
android:paddingTop="@dimen/dimen4dp"
|
||||
android:paddingBottom="@dimen/dimen4dp"
|
||||
android:paddingStart="@dimen/dimen16dp"
|
||||
android:paddingEnd="@dimen/dimen16dp"
|
||||
android:textSize="@dimen/dimen14sp" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/mainThreadCard"
|
||||
android:layout_marginTop="@dimen/dimen16dp"
|
||||
android:layout_below="@+id/notes_info_card"
|
||||
android:background="?attr/primaryBackgroundColor">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
@@ -12,6 +13,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/dimen12dp"
|
||||
android:paddingEnd="@dimen/dimen0dp"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
@@ -133,13 +135,13 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/attachmentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/materialCardBackgroundColor"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/attachmentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/materialCardBackgroundColor"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
@@ -179,6 +181,7 @@
|
||||
android:id="@+id/timeline_line_2"
|
||||
android:layout_width="@dimen/dimen2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
android:background="?attr/colorPrimary" />
|
||||
|
||||
<LinearLayout
|
||||
@@ -190,6 +193,7 @@
|
||||
android:paddingEnd="@dimen/dimen0dp"
|
||||
android:layout_marginStart="@dimen/dimen6dp"
|
||||
android:layout_marginEnd="@dimen/dimen4dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -198,6 +202,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/prInfo"
|
||||
android:icon="@drawable/ic_info"
|
||||
android:orderInCategory="0"
|
||||
android:title="@string/infoMoreInformation"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
</menu>
|
||||
@@ -553,6 +553,7 @@
|
||||
<string name="unpin">Unpin</string>
|
||||
<string name="branch">Branch</string>
|
||||
<string name="branches">Branches</string>
|
||||
<string name="timeline">Timeline</string>
|
||||
<!-- generic copy -->
|
||||
|
||||
<string name="exploreUsers">Explore users</string>
|
||||
@@ -763,6 +764,7 @@
|
||||
<string name="prClosed">Pull Request closed</string>
|
||||
<string name="prReopened">Pull Request reopened</string>
|
||||
<string name="prMergeInfo">Pull Request Info</string>
|
||||
<string name="pr_info">%1$s wants to merge branch %2$s into %3$s</string>
|
||||
|
||||
<string name="accountDoesNotExist">It seems that the account for URI %1$s does not exist in the app. You can add one by tapping on the Add New Account button.</string>
|
||||
<string name="launchApp">Go to App</string>
|
||||
@@ -857,7 +859,7 @@
|
||||
<string name="noNotes">No notes found</string>
|
||||
|
||||
<!-- timeline -->
|
||||
<string name="commitsText">commit</string>
|
||||
<string name="commitsText">commits</string>
|
||||
<string name="commitText">commit</string>
|
||||
<string name="timelineAddedCommit">%1$s added %2$s %3$s</string>
|
||||
<!-- the | is replaced by the label -->
|
||||
|
||||
Reference in New Issue
Block a user