mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-07-15 21:25:46 -05:00
Add Signal style space at the bottom which also fix the overlap issue by comment button
This commit is contained in:
@@ -6,7 +6,6 @@ import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -24,13 +23,13 @@ import android.widget.ScrollView;
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
@@ -59,6 +58,7 @@ import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.ColorInverter;
|
||||
import org.mian.gitnex.helpers.DividerItemDecorator;
|
||||
import org.mian.gitnex.helpers.LabelWidthCalculator;
|
||||
import org.mian.gitnex.helpers.Markdown;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
@@ -82,7 +82,7 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class IssueDetailActivity extends BaseActivity implements LabelsListAdapter.LabelsListAdapterListener, AssigneesListAdapter.AssigneesListAdapterListener, BottomSheetListener {
|
||||
@@ -154,7 +154,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
||||
viewBinding.recyclerView.setNestedScrollingEnabled(false);
|
||||
viewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(viewBinding.recyclerView.getContext(), DividerItemDecoration.VERTICAL);
|
||||
RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.shape_list_divider));
|
||||
viewBinding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
viewBinding.addNewComment.setOnClickListener(v -> {
|
||||
@@ -162,7 +162,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
||||
BottomSheetReplyFragment bottomSheetReplyFragment = BottomSheetReplyFragment.newInstance(new Bundle(), issue);
|
||||
bottomSheetReplyFragment.setOnInteractedListener(this::onResume);
|
||||
bottomSheetReplyFragment.show(getSupportFragmentManager(), "replyBottomSheet");
|
||||
|
||||
});
|
||||
|
||||
labelsAdapter = new LabelsListAdapter(labelsList, IssueDetailActivity.this, currentLabelsIds);
|
||||
@@ -170,29 +169,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
||||
LabelsActions.getCurrentIssueLabels(ctx, repoOwner, repoName, issueIndex, currentLabelsIds);
|
||||
AssigneesActions.getCurrentIssueAssignees(ctx, repoOwner, repoName, issueIndex, currentAssignees);
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
||||
viewBinding.scrollViewComments.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
|
||||
|
||||
if((scrollY - oldScrollY) > 0 && viewBinding.addNewComment.isShown()) {
|
||||
viewBinding.addNewComment.setVisibility(View.GONE);
|
||||
}
|
||||
else if((scrollY - oldScrollY) < 0) {
|
||||
viewBinding.addNewComment.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!viewBinding.scrollViewComments.canScrollVertically(1)) { // bottom
|
||||
viewBinding.addNewComment.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!viewBinding.scrollViewComments.canScrollVertically(-1)) { // top
|
||||
viewBinding.addNewComment.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
viewBinding.pullToRefresh.setOnRefreshListener(() -> new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
|
||||
viewBinding.pullToRefresh.setRefreshing(false);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.mian.gitnex.helpers;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class DividerItemDecorator extends RecyclerView.ItemDecoration {
|
||||
|
||||
private final Drawable rvDivider;
|
||||
|
||||
public DividerItemDecorator(Drawable divider) {
|
||||
rvDivider = divider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawOver(@NonNull Canvas canvas, RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
|
||||
int dividerLeft = parent.getPaddingLeft();
|
||||
int dividerRight = parent.getWidth() - parent.getPaddingRight();
|
||||
|
||||
int childCount = parent.getChildCount();
|
||||
for (int i = 0; i <= childCount - 2; i++) {
|
||||
View child = parent.getChildAt(i);
|
||||
|
||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
|
||||
int dividerTop = child.getBottom() + params.bottomMargin;
|
||||
int dividerBottom = dividerTop + rvDivider.getIntrinsicHeight();
|
||||
|
||||
rvDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
|
||||
rvDivider.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size android:width="1px" android:height="1px" />
|
||||
<solid android:color="@color/toastBackground" />
|
||||
<size android:width="1dp" android:height="1dp" />
|
||||
<solid android:color="?attr/dividerColor" />
|
||||
</shape>
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
android:textColor="@color/colorWhite"
|
||||
android:backgroundTint="?attr/fabColor"
|
||||
android:layout_gravity="bottom|end"
|
||||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
||||
app:iconTint="@color/colorWhite"
|
||||
app:icon="@drawable/ic_reply" />
|
||||
|
||||
@@ -256,6 +255,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:paddingBottom="72dp"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user