Hide support button and comments consistently with claim tags (#1152)
* Hide support button and comments consistently with claim tags * Set visibility to GONE instead of INVISIBLE for the tipping button
This commit is contained in:
parent
f328efb831
commit
67b883660f
6 changed files with 74 additions and 6 deletions
|
@ -187,9 +187,21 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||||
private void checkAndLoadComments() {
|
private void checkAndLoadComments() {
|
||||||
View root = getView();
|
View root = getView();
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
|
View commentsDisabledText = root.findViewById(R.id.channel_disabled_comments);
|
||||||
|
View commentForm = root.findViewById(R.id.container_comment_form);
|
||||||
RecyclerView commentsList = root.findViewById(R.id.channel_comments_list);
|
RecyclerView commentsList = root.findViewById(R.id.channel_comments_list);
|
||||||
if (commentsList == null || commentsList.getAdapter() == null || commentsList.getAdapter().getItemCount() == 0) {
|
|
||||||
loadComments();
|
if (claim.getTags().contains("disable-comments")) {
|
||||||
|
Helper.setViewVisibility(commentsDisabledText, View.VISIBLE);
|
||||||
|
Helper.setViewVisibility(commentForm, View.GONE);
|
||||||
|
Helper.setViewVisibility(commentsList, View.GONE);
|
||||||
|
} else {
|
||||||
|
Helper.setViewVisibility(commentsDisabledText, View.GONE);
|
||||||
|
Helper.setViewVisibility(commentForm, View.VISIBLE);
|
||||||
|
Helper.setViewVisibility(commentsList, View.VISIBLE);
|
||||||
|
if (commentsList == null || commentsList.getAdapter() == null || commentsList.getAdapter().getItemCount() == 0) {
|
||||||
|
loadComments();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -503,6 +503,11 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||||
layoutLoadingState.setVisibility(View.GONE);
|
layoutLoadingState.setVisibility(View.GONE);
|
||||||
layoutDisplayArea.setVisibility(View.VISIBLE);
|
layoutDisplayArea.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (claim.getTags().contains("disable-support"))
|
||||||
|
buttonTip.setVisibility(View.GONE);
|
||||||
|
else
|
||||||
|
buttonTip.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
String thumbnailUrl = claim.getThumbnailUrl();
|
String thumbnailUrl = claim.getThumbnailUrl();
|
||||||
String coverUrl = claim.getCoverUrl();
|
String coverUrl = claim.getCoverUrl();
|
||||||
textTitle.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
|
textTitle.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
|
||||||
|
|
|
@ -210,6 +210,8 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
private View layoutResolving;
|
private View layoutResolving;
|
||||||
private int lastPositionSaved;
|
private int lastPositionSaved;
|
||||||
|
|
||||||
|
private View tipButton;
|
||||||
|
|
||||||
private WebView webView;
|
private WebView webView;
|
||||||
private boolean webViewAdded;
|
private boolean webViewAdded;
|
||||||
|
|
||||||
|
@ -255,6 +257,8 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
layoutDisplayArea = root.findViewById(R.id.file_view_claim_display_area);
|
layoutDisplayArea = root.findViewById(R.id.file_view_claim_display_area);
|
||||||
buttonPublishSomething = root.findViewById(R.id.nothing_at_location_publish_button);
|
buttonPublishSomething = root.findViewById(R.id.nothing_at_location_publish_button);
|
||||||
|
|
||||||
|
tipButton = root.findViewById(R.id.file_view_action_tip);
|
||||||
|
|
||||||
containerReplyToComment = root.findViewById(R.id.comment_form_reply_to_container);
|
containerReplyToComment = root.findViewById(R.id.comment_form_reply_to_container);
|
||||||
textReplyingTo = root.findViewById(R.id.comment_form_replying_to_text);
|
textReplyingTo = root.findViewById(R.id.comment_form_replying_to_text);
|
||||||
textReplyToBody = root.findViewById(R.id.comment_form_reply_to_body);
|
textReplyToBody = root.findViewById(R.id.comment_form_reply_to_body);
|
||||||
|
@ -1497,6 +1501,11 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
Helper.setViewVisibility(layoutLoadingState, View.GONE);
|
Helper.setViewVisibility(layoutLoadingState, View.GONE);
|
||||||
Helper.setViewVisibility(layoutNothingAtLocation, View.GONE);
|
Helper.setViewVisibility(layoutNothingAtLocation, View.GONE);
|
||||||
|
|
||||||
|
if (claim.getTags().contains("disable-support") || claim.getSigningChannel().getTags().contains("disable-support"))
|
||||||
|
Helper.setViewVisibility(tipButton, View.GONE);
|
||||||
|
else
|
||||||
|
Helper.setViewVisibility(tipButton, View.VISIBLE);
|
||||||
|
|
||||||
loadViewCount();
|
loadViewCount();
|
||||||
checkIsFollowing();
|
checkIsFollowing();
|
||||||
|
|
||||||
|
@ -1679,9 +1688,20 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
private void checkAndLoadComments() {
|
private void checkAndLoadComments() {
|
||||||
View root = getView();
|
View root = getView();
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
|
View commentsDisabledText = root.findViewById(R.id.file_view_disabled_comments);
|
||||||
|
View commentForm = root.findViewById(R.id.container_comment_form);
|
||||||
RecyclerView commentsList = root.findViewById(R.id.file_view_comments_list);
|
RecyclerView commentsList = root.findViewById(R.id.file_view_comments_list);
|
||||||
if (commentsList == null || commentsList.getAdapter() == null || commentsList.getAdapter().getItemCount() == 0) {
|
if (claim.getTags().contains("disable-comments") || claim.getSigningChannel().getTags().contains("disable-comments")) {
|
||||||
loadComments();
|
Helper.setViewVisibility(commentsDisabledText, View.VISIBLE);
|
||||||
|
Helper.setViewVisibility(commentForm, View.GONE);
|
||||||
|
Helper.setViewVisibility(commentsList, View.GONE);
|
||||||
|
} else {
|
||||||
|
Helper.setViewVisibility(commentsDisabledText, View.GONE);
|
||||||
|
Helper.setViewVisibility(commentForm, View.VISIBLE);
|
||||||
|
Helper.setViewVisibility(commentsList, View.VISIBLE);
|
||||||
|
if (commentsList == null || commentsList.getAdapter() == null || commentsList.getAdapter().getItemCount() == 0) {
|
||||||
|
loadComments();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,27 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include layout="@layout/container_comment_form"
|
<include layout="@layout/container_comment_form"
|
||||||
|
android:id="@+id/container_comment_form"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="16dp" />
|
android:layout_marginBottom="16dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/channel_disabled_comments"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:text="@string/channel_disabled_comments"
|
||||||
|
android:textFontWeight="300"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/channel_no_comments"
|
android:id="@+id/channel_no_comments"
|
||||||
|
|
|
@ -845,7 +845,21 @@
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<include layout="@layout/container_comment_form" />
|
<include layout="@layout/container_comment_form"
|
||||||
|
android:id="@+id/container_comment_form"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/file_view_disabled_comments"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:text="@string/creator_disabled_comments"
|
||||||
|
android:textFontWeight="300"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/file_view_no_comments"
|
android:id="@+id/file_view_no_comments"
|
||||||
|
|
|
@ -64,6 +64,8 @@
|
||||||
<string name="no_comments">No comments to display at this time.</string>
|
<string name="no_comments">No comments to display at this time.</string>
|
||||||
<string name="sdk_initializing_comments">Comments will display after the background service is initialized.</string>
|
<string name="sdk_initializing_comments">Comments will display after the background service is initialized.</string>
|
||||||
<string name="comment_error">Your comment could not be posted at this time. Please try again later.</string>
|
<string name="comment_error">Your comment could not be posted at this time. Please try again later.</string>
|
||||||
|
<string name="channel_disabled_comments">This channel has disabled comments on their page.</string>
|
||||||
|
<string name="creator_disabled_comments">The creator of this content has disabled comments.</string>
|
||||||
<string name="share_lbry_content">Share LBRY content</string>
|
<string name="share_lbry_content">Share LBRY content</string>
|
||||||
<string name="view">View</string>
|
<string name="view">View</string>
|
||||||
<string name="play">Play</string>
|
<string name="play">Play</string>
|
||||||
|
|
Loading…
Reference in a new issue