Skip to content

Commit 3ce3a69

Browse files
authored
Merge pull request #31 from FastComments/theme-comments-dialog
Fix theme not applying to CommentsDialog from Feed
2 parents 63215e5 + fb4ce2e commit 3ce3a69

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

libraries/sdk/src/main/java/com/fastcomments/sdk/CommentsDialog.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ protected void onCreate(Bundle savedInstanceState) {
120120
FastCommentsSDK commentsSDK = feedSDK.createCommentsSDKForPost(post);
121121
commentsView = new FastCommentsView(getContext(), commentsSDK);
122122

123+
// Apply theme colors to dialog header if theme is available
124+
if (feedSDK.getTheme() != null) {
125+
FrameLayout headerContainer = findViewById(R.id.headerContainer);
126+
headerContainer.setBackgroundColor(
127+
ThemeColorResolver.getDialogHeaderBackgroundColor(getContext(), feedSDK.getTheme())
128+
);
129+
130+
titleTextView.setTextColor(
131+
ThemeColorResolver.getDialogHeaderTextColor(getContext(), feedSDK.getTheme())
132+
);
133+
}
134+
123135
// Set user click listener if one was provided
124136
if (userClickListener != null) {
125137
commentsView.setOnUserClickListener(userClickListener);

libraries/sdk/src/main/java/com/fastcomments/sdk/FastCommentsFeedSDK.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,14 @@ public FastCommentsSDK createCommentsSDKForPost(FeedPost post) {
699699
}
700700

701701
// Create a new FastCommentsSDK with this config
702-
return new FastCommentsSDK(config);
702+
FastCommentsSDK commentsSDK = new FastCommentsSDK(config);
703+
704+
// Pass the theme from the feed SDK to the comments SDK
705+
if (this.theme != null) {
706+
commentsSDK.setTheme(this.theme);
707+
}
708+
709+
return commentsSDK;
703710
}
704711

705712

0 commit comments

Comments
 (0)