mirror of
https://codeberg.org/gitnex/GitNex
synced 2025-03-11 17:10:08 +01:00
Fixing scrolling. (#751)
Fixing scrolling. Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/751 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
parent
4a9bde8731
commit
5807d11e8c
@ -1,12 +1,14 @@
|
||||
package org.mian.gitnex.fragments;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
@ -14,6 +16,7 @@ import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.actions.ActionResult;
|
||||
@ -54,6 +57,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@ -104,6 +108,25 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
||||
}
|
||||
|
||||
commentContent.requestFocus();
|
||||
commentContent.setOnTouchListener((v, event) -> {
|
||||
|
||||
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) view.getParent());
|
||||
|
||||
switch(event.getAction()) {
|
||||
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_SCROLL:
|
||||
bottomSheetBehavior.setDraggable(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
bottomSheetBehavior.setDraggable(true);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
commentContent.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@ -23,11 +24,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/menuEditText"
|
||||
android:drawableStart="@drawable/ic_edit"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
android:padding="12dp"
|
||||
app:drawableStartCompat="@drawable/ic_edit" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentMenuDelete"
|
||||
@ -35,11 +36,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/menuDeleteText"
|
||||
android:drawableStart="@drawable/ic_delete"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
android:padding="12dp"
|
||||
app:drawableStartCompat="@drawable/ic_delete" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentMenuQuote"
|
||||
@ -47,11 +48,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/menuQuoteText"
|
||||
android:drawableStart="@drawable/ic_comment"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
android:padding="12dp"
|
||||
app:drawableStartCompat="@drawable/ic_comment" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentMenuCopy"
|
||||
@ -59,11 +60,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/copyCommentText"
|
||||
android:drawableStart="@drawable/ic_copy"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
android:padding="12dp"
|
||||
app:drawableStartCompat="@drawable/ic_copy" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issueCommentShare"
|
||||
@ -71,11 +72,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/issueCommentShare"
|
||||
android:drawableStart="@drawable/ic_share"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
android:padding="12dp"
|
||||
app:drawableStartCompat="@drawable/ic_share" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issueCommentCopyUrl"
|
||||
@ -83,11 +84,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/genericCopyUrl"
|
||||
android:drawableStart="@drawable/ic_link"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
android:padding="12dp"
|
||||
app:drawableStartCompat="@drawable/ic_link" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -73,47 +73,39 @@
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<ScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:isScrollContainer="true"
|
||||
android:padding="15dp">
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<EditText
|
||||
android:id="@+id/comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:background="@drawable/shape_inputs"
|
||||
android:inputType="textMultiLine|textImeMultiLine"
|
||||
android:maxLines="5"
|
||||
android:padding="10dp"
|
||||
android:scrollbars="vertical"
|
||||
android:textColor="?attr/inputTextColor"
|
||||
android:textColorHighlight="?attr/primaryTextColor"
|
||||
android:textColorHint="?attr/primaryBackgroundColor"
|
||||
android:textSize="16sp"
|
||||
android:labelFor="@+id/comment"
|
||||
android:autofillHints="@string/commentButtonText" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_inputs"
|
||||
android:inputType="textMultiLine|textImeMultiLine"
|
||||
android:maxLines="5"
|
||||
android:padding="10dp"
|
||||
android:scrollbars="vertical"
|
||||
android:textColor="?attr/inputTextColor"
|
||||
android:textColorHighlight="?attr/primaryTextColor"
|
||||
android:textColorHint="?attr/primaryBackgroundColor"
|
||||
android:textSize="16sp"
|
||||
android:labelFor="@+id/comment"
|
||||
android:autofillHints="@string/commentButtonText" />
|
||||
<TextView
|
||||
android:id="@+id/drafts_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/draftSaved"
|
||||
android:textColor="?attr/hintColor"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/drafts_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/draftSaved"
|
||||
android:textColor="?attr/hintColor"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user