[WIP] Add Issue/Comment Reactions #490
|
@ -6,6 +6,7 @@ import org.mian.gitnex.models.Branches;
|
|||
import org.mian.gitnex.models.Commits;
|
||||
import org.mian.gitnex.models.ExploreRepositories;
|
||||
import org.mian.gitnex.models.Files;
|
||||
import org.mian.gitnex.models.IssueReaction;
|
||||
import org.mian.gitnex.models.MergePullRequest;
|
||||
import org.mian.gitnex.models.NewFile;
|
||||
import org.mian.gitnex.models.PullRequests;
|
||||
|
@ -174,6 +175,15 @@ public interface ApiInterface {
|
|||
@PATCH("repos/{owner}/{repo}/issues/comments/{commentId}") // edit a comment
|
||||
Call<IssueComments> patchIssueComment(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("commentId") int commentId, @Body IssueComments jsonStr);
|
||||
|
||||
@GET("repos/{owner}/{repo}/issues/comments/{commentId}/reactions") // get comment reactions
|
||||
Call<List<IssueReaction>> getIssueCommentReaction(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("commentId") int commentId);
|
||||
|
||||
@PUT("repos/{owner}/{repo}/issues/comments/{commentId}/reactions") // add reaction to a comment
|
||||
Call<IssueReaction> setIssueCommentReaction(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("commentId") int commentId, @Body IssueReaction jsonStr);
|
||||
|
||||
@DELETE("repos/{owner}/{repo}/issues/comments/{commentId}/reactions") // delete a reaction of a comment
|
||||
Call<IssueReaction> delIssueCommentReaction(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("commentId") int commentId, @Body IssueReaction jsonStr);
|
||||
|
||||
@GET("user/followers") // get user followers
|
||||
Call<List<UserInfo>> getFollowers(@Header("Authorization") String token);
|
||||
|
||||
|
@ -192,6 +202,15 @@ public interface ApiInterface {
|
|||
@PUT("repos/{owner}/{repo}/issues/{index}/labels") // replace an issue's labels
|
||||
Call<JsonElement> updateIssueLabels(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex, @Body Labels jsonStr);
|
||||
|
||||
@GET("repos/{owner}/{repo}/issues/{index}/reactions") // get issue reactions
|
||||
Call<List<IssueReaction>> getIssueReactions(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex);
|
||||
|
||||
@PUT("repos/{owner}/{repo}/issues/{index}/reactions") // add reaction to an issue
|
||||
Call<IssueReaction> setIssueReaction(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex, @Body IssueReaction jsonStr);
|
||||
|
||||
@DELETE("repos/{owner}/{repo}/issues/{index}/reactions") // delete a reaction of an issue
|
||||
Call<IssueReaction> delIssueReaction(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex, @Body IssueReaction jsonStr);
|
||||
|
||||
@GET("repos/{owner}/{repo}/raw/{filename}") // get file contents
|
||||
Call<String> getFileContents(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("filename") String filename);
|
||||
|
||||
|
|
71
app/src/main/java/org/mian/gitnex/models/IssueReaction.java
Normal file
71
app/src/main/java/org/mian/gitnex/models/IssueReaction.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package org.mian.gitnex.models;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Author 6543
|
||||
*/
|
||||
|
||||
public class IssueReaction {
|
||||
|
||||
private String content;
|
||||
private userObject user;
|
||||
private Date created_at;
|
||||
|
||||
public IssueReaction(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public class userObject {
|
||||
|
||||
private int id;
|
||||
private String login;
|
||||
private String full_name;
|
||||
private String email;
|
||||
private String avatar_url;
|
||||
private String language;
|
||||
private String username;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public String getFull_name() {
|
||||
return full_name;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public userObject getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public Date getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
}
|
5
app/src/main/res/drawable/circle_reactions.xml
Normal file
5
app/src/main/res/drawable/circle_reactions.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid
|
||||
android:color="?attr/inputBackgroundColor"/>
|
||||
</shape>
|
8
app/src/main/res/drawable/round_corners_reactions.xml
Normal file
8
app/src/main/res/drawable/round_corners_reactions.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<corners android:radius="7dp"/>
|
||||
<solid android:color="?attr/inputBackgroundColor" />
|
||||
|
||||
</shape>
|
|
@ -189,8 +189,20 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/reactionsMainFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/issueTimeFrame"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp" >
|
||||
|
||||
<include layout="@layout/layout_reactions" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_below="@id/issueTimeFrame"
|
||||
android:layout_below="@id/reactionsMainFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:id="@+id/divider"
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:paddingTop="8dp">
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -14,44 +13,46 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/layout_add_reactions"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentMenuEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/menuEditText"
|
||||
android:drawableStart="@drawable/ic_edit"
|
||||
android:drawablePadding="24dp"
|
||||
android:padding="16dp"
|
||||
android:text="@string/menuEditText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="16dp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentMenuDelete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/menuDeleteText"
|
||||
android:drawableStart="@drawable/ic_delete"
|
||||
android:drawablePadding="24dp"
|
||||
android:padding="16dp"
|
||||
android:text="@string/menuDeleteText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="16dp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issueCommentShare"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/issueCommentShare"
|
||||
android:drawableStart="@drawable/ic_share_24dp"
|
||||
android:drawablePadding="24dp"
|
||||
android:padding="16dp"
|
||||
android:text="@string/issueCommentShare"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="16dp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:paddingTop="8dp">
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -17,6 +17,8 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/layout_add_reactions"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/openFilesDiff"
|
||||
android:layout_width="match_parent"
|
||||
|
|
35
app/src/main/res/layout/layout_add_reactions.xml
Normal file
35
app/src/main/res/layout/layout_add_reactions.xml
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/addReactionsFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/addReactionsContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingBottom="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addReactionTemplate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/circle_reactions"
|
||||
android:padding="10dp"
|
||||
android:text="👍"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</HorizontalScrollView>
|
33
app/src/main/res/layout/layout_reactions.xml
Normal file
33
app/src/main/res/layout/layout_reactions.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/reactionsFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reactionsContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reactionTemplate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/round_corners_reactions"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="👍 1"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
</HorizontalScrollView>
|
|
@ -59,26 +59,27 @@
|
|||
android:id="@+id/issueComment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textIsSelectable="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:autoLink="web"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textColorLink="@color/lightBlue"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/commentsDetailMainFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/commentsDetailMainFrame"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight=".90"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/commentsDetailFrame"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="3dp">
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight=".90"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issueCommentDate"
|
||||
|
@ -92,25 +93,27 @@
|
|||
android:id="@+id/commentModified"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:layout_toEndOf="@+id/issueCommentDate"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/modifiedText" />
|
||||
android:text="@string/modifiedText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/commentsOptionsMenu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight=".10"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_weight=".10"
|
||||
android:contentDescription="@string/menuContentDesc"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/ic_dotted_menu_horizontal"
|
||||
android:contentDescription="@string/menuContentDesc" />
|
||||
android:src="@drawable/ic_dotted_menu_horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/layout_reactions" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<color name="lightThemeDiffSelectedColor">#e0e0e0</color>
|
||||
<color name="lightThemeTextColor">#646565</color>
|
||||
<color name="lightThemeBackground">#f9f9f9</color>
|
||||
<color name="lightThemeInputBackground">#b6bbbf</color>
|
||||
<color name="lightThemeInputBackground">#D4D7DA</color>
|
||||
<color name="lightThemeInputTextColor">#212121</color>
|
||||
<color name="lightThemeDividerColor">#dbdbdb</color>
|
||||
|
||||
|
|
Reference in New Issue
Block a user