New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
display reactions #2554
Merged
Merged
display reactions #2554
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
de1f1d4
implement `get_msg_reactions()` JSON-RPC API
adbenitez a38ad25
basic display of reactions
adbenitez 49602bd
improve ConversationItem
adbenitez 974bec7
fix error
adbenitez bd9d535
listen to DC_EVENT_REACTIONS_CHANGED event
adbenitez File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="1000dp" /> | ||
<solid android:color="@color/reaction_pill_background" /> | ||
<stroke android:color="@color/reaction_pill_border" android:width="1dp" /> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="1000dp" /> | ||
<solid android:color="@color/reaction_pill_background_selected" /> | ||
<stroke android:color="@color/reaction_pill_border_selected" android:width="1dp" /> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
tools:viewBindingIgnore="true" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:orientation="horizontal" | ||
android:layout_width="wrap_content" | ||
android:layout_height="26dp" | ||
android:layout_marginStart="1dp" | ||
android:layout_marginEnd="1dp" | ||
android:paddingStart="7dp" | ||
android:paddingEnd="7dp" | ||
android:gravity="center"> | ||
|
||
<org.thoughtcrime.securesms.components.emoji.EmojiImageView | ||
android:id="@+id/reactions_pill_emoji" | ||
android:layout_width="17dp" | ||
android:layout_height="17dp" /> | ||
|
||
<Space | ||
android:id="@+id/reactions_pill_spacer" | ||
android:layout_width="4dp" | ||
android:layout_height="wrap_content" /> | ||
|
||
<TextView | ||
android:id="@+id/reactions_pill_count" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:paddingTop="5dp" | ||
android:paddingBottom="5dp" | ||
android:textSize="12dp" | ||
android:fontFamily="sans-serif-medium" | ||
android:textColor="@color/reaction_pill_text_color" | ||
tools:text="23" | ||
tools:ignore="SpUsage" /> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<resources> | ||
<color name="reaction_pill_background">@color/black</color> | ||
<color name="reaction_pill_border">#80414347</color> | ||
<color name="reaction_pill_text_color">@color/core_dark_05</color> | ||
<color name="reaction_pill_background_selected">#ff282828</color> | ||
<color name="reaction_pill_border_selected">@color/reaction_pill_border</color> | ||
<color name="reaction_pill_text_color_selected">@color/reaction_pill_text_color</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.b44t.messenger.rpc; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
public class Reaction { | ||
// The reaction emoji string. | ||
private final String emoji; | ||
// The count of users that have reacted with this reaction. | ||
private final int count; | ||
// true if self-account reacted with this reaction, false otherwise. | ||
private final boolean isFromSelf; | ||
|
||
public Reaction(String emoji, int count, boolean isFromSelf) { | ||
this.emoji = emoji; | ||
this.count = count; | ||
this.isFromSelf = isFromSelf; | ||
} | ||
|
||
public String getEmoji() { | ||
return emoji; | ||
} | ||
|
||
public int getCount() { | ||
return count; | ||
} | ||
|
||
public boolean isFromSelf() { | ||
return isFromSelf; | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
if (obj instanceof Reaction) { | ||
Reaction reaction = (Reaction) obj; | ||
return emoji.equals(reaction.getEmoji()) && count == reaction.getCount() && isFromSelf == reaction.isFromSelf(); | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.b44t.messenger.rpc; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class Reactions { | ||
// Map from a contact to it's reaction to message. | ||
private final HashMap<Integer, String[]> reactionsByContact; | ||
// Unique reactions, sorted in descending order. | ||
private final ArrayList<Reaction> reactions; | ||
|
||
public Reactions(HashMap<Integer, String[]> reactionsByContact, ArrayList<Reaction> reactions) { | ||
this.reactionsByContact = reactionsByContact; | ||
this.reactions = reactions; | ||
} | ||
|
||
public Map<Integer, String[]> getReactionsByContact() { | ||
return reactionsByContact; | ||
} | ||
|
||
public List<Reaction> getReactions() { | ||
return reactions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
red pill or blue pill?