Delete branch after merge (#496)

delete branch API call

Add fork repo info for branch

Check if pr is mergeable, show message if not.

Use checkbox instead of button

make ripple effects work for buttons with enable/disable

introduce viewbinding

Co-authored-by: 6543 <6543@noreply.gitea.io>
Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/496
Reviewed-by: 6543 <6543@noreply.gitea.io>
This commit is contained in:
M M Arif
2020-05-21 22:49:09 +00:00
committed by 6543
co-authored by 6543
parent 1b213783bc
commit d06f5353c6
10 changed files with 338 additions and 83 deletions
+34 -16
View File
@@ -1,21 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorPrimaryDark">
<solid
android:color="@color/btnBackground">
</solid>
<item android:id="@android:id/mask">
<corners
android:radius="3dp">
</corners>
<shape android:shape="rectangle">
<padding
android:top="0dp"
android:right="10dp"
android:left="10dp"
android:bottom="0dp">
</padding>
<solid android:color="@color/btnBackground" />
<corners android:radius="3dp" />
</shape>
</shape>
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="@color/btnBackground"
android:startColor="@color/btnBackground"
android:type="linear" />
<corners android:radius="3dp" />
<padding
android:top="0dp"
android:bottom="0dp"
android:left="10dp"
android:right="10dp"
/>
</shape>
</item>
</ripple>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/hintColor">
</solid>
<corners
android:radius="3dp">
</corners>
<padding
android:top="0dp"
android:right="10dp"
android:left="10dp"
android:bottom="0dp">
</padding>
</shape>
@@ -123,6 +123,27 @@
</RelativeLayout>
<CheckBox
android:id="@+id/deleteBranch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/deleteBranchAfterMerge"
android:checked="false"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:textColor="?attr/primaryTextColor"/>
<TextView
android:id="@+id/deleteBranchForkInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/deleteBranchForkInfo"
android:textColor="?attr/hintColor"
android:textSize="12sp"
android:gravity="start"
android:layout_marginTop="0dp" />
<TextView
android:id="@+id/mergeInfo"
android:layout_width="match_parent"
@@ -131,7 +152,7 @@
android:textColor="?attr/hintColor"
android:textSize="12sp"
android:gravity="start"
android:layout_marginTop="10dp" />
android:layout_marginTop="15dp" />
<Button
android:id="@+id/mergeButton"
@@ -144,6 +165,17 @@
android:background="@drawable/shape_buttons"
android:textColor="@color/btnTextColor" />
<TextView
android:id="@+id/mergeInfoDisabledMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mergeInfoDisabledMessage"
android:textColor="?attr/hintColor"
android:textSize="12sp"
android:gravity="start"
android:visibility="gone"
android:layout_marginTop="10dp" />
</LinearLayout>
</ScrollView>
+24
View File
@@ -14,6 +14,30 @@
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/prMergeable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/prHeadBranch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/prIsFork"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/prForkFullName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<ImageView
android:id="@+id/assigneeAvatar"
android:layout_width="48dp"
+3
View File
@@ -594,7 +594,10 @@
<string name="openFileDiffText">Files Changed</string>
<string name="mergePullRequestText">Merge Pull Request</string>
<string name="mergePullRequestButtonText">Merge</string>
<string name="deleteBranchAfterMerge">Delete branch after merge</string>
<string name="mergeNoteText">Merge may fail if you are not authorized to merge this Pull Request.</string>
<string name="mergeInfoDisabledMessage">Disabled Merge button means that there are conflicts OR other things to fix before Merge.</string>
<string name="deleteBranchForkInfo">This branch belong to a forked repository</string>
<string name="mergeCommentText">Merge comment</string>
<string name="mergePRSuccessMsg">Pull Request was merged successfully</string>
<string name="mergePR404ErrorMsg">Pull Request is not available for merge</string>