Removing left-over space in case no reactions are available (#782)

update gradle

Removing left-over space in case no reactions are available.

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/782
Reviewed-by: 6543 <6543@noreply.codeberg.org>
This commit is contained in:
opyale 2020-11-30 00:26:01 +01:00 committed by 6543
parent f2bc81210c
commit b871a1fb22
6 changed files with 29 additions and 4 deletions

View File

@ -735,9 +735,17 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
bundle.putInt("issueId", singleIssue.getNumber());
ReactionList reactionList = new ReactionList(ctx, bundle);
viewBinding.commentReactionBadges.removeAllViews();
viewBinding.commentReactionBadges.addView(reactionList);
reactionList.setOnReactionAddedListener(() -> {
if(viewBinding.commentReactionBadges.getVisibility() != View.VISIBLE) {
viewBinding.commentReactionBadges.post(() -> viewBinding.commentReactionBadges.setVisibility(View.VISIBLE));
}
});
if(singleIssue.getMilestone() != null) {
viewBinding.issueMilestone.setVisibility(View.VISIBLE);

View File

@ -24,7 +24,6 @@ import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.fragments.BottomSheetReplyFragment;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.ClickListener;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper;
@ -331,8 +330,8 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
if(timeFormat.equals("pretty")) {
informationBuilder = new StringBuilder(TimeHelper.formatTime(issueComment.getCreated_at(), Locale.getDefault(), "pretty", ctx));
holder.information
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(issueComment.getCreated_at()), ctx));
holder.information.setOnClickListener(v -> TimeHelper.customDateFormatForToastDateFormat(issueComment.getCreated_at()));
}
else if(timeFormat.equals("normal")) {
@ -355,7 +354,14 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
bundle1.putInt("commentId", issueComment.getId());
ReactionList reactionList = new ReactionList(ctx, bundle1);
holder.commentReactionBadges.addView(reactionList);
reactionList.setOnReactionAddedListener(() -> {
if(holder.commentReactionBadges.getVisibility() != View.VISIBLE) {
holder.commentReactionBadges.post(() -> holder.commentReactionBadges.setVisibility(View.VISIBLE));
}
});
}

View File

@ -33,6 +33,7 @@ import retrofit2.Response;
public class ReactionList extends HorizontalScrollView {
private enum ReactionType { COMMENT, ISSUE }
private OnReactionAddedListener onReactionAddedListener;
@SuppressLint("SetTextI18n")
public ReactionList(Context context, Bundle bundle) {
@ -127,7 +128,9 @@ public class ReactionList extends HorizontalScrollView {
Emoji emoji = EmojiManager.getForAlias(content);
((TextView) reactionBadge.findViewById(R.id.symbol)).setText(((emoji == null) ? content : emoji.getUnicode()) + " " + issueReactions.size());
root.post(() -> root.addView(reactionBadge));
onReactionAddedListener.reactionAdded();
}
@ -137,4 +140,10 @@ public class ReactionList extends HorizontalScrollView {
}
public void setOnReactionAddedListener(OnReactionAddedListener onReactionAddedListener) {
this.onReactionAddedListener = onReactionAddedListener;
}
public interface OnReactionAddedListener { void reactionAdded(); }
}

View File

@ -230,6 +230,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/issueTimeFrame"
android:visibility="gone"
android:layout_marginTop="10dp"
android:orientation="horizontal" />

View File

@ -77,6 +77,7 @@
android:id="@+id/commentReactionBadges"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="15dp"
android:orientation="horizontal" />

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.1'
}
}