From f111f7f2dfe2412fa0f0977a4f7371b56b3cc25b Mon Sep 17 00:00:00 2001 From: M M Arif Date: Fri, 30 Oct 2020 08:00:52 +0100 Subject: [PATCH] Fix scrolling issue for textareas (#752) Add info msg for merge 405 Fix scrolling issue for textareas Co-authored-by: M M Arif Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/752 --- .../mian/gitnex/activities/CreateFileActivity.java | 14 ++++++++++++++ .../gitnex/activities/CreateIssueActivity.java | 14 ++++++++++++++ .../gitnex/activities/CreateMilestoneActivity.java | 14 ++++++++++++++ .../activities/CreateOrganizationActivity.java | 14 ++++++++++++++ .../activities/CreatePullRequestActivity.java | 14 ++++++++++++++ .../gitnex/activities/CreateReleaseActivity.java | 14 ++++++++++++++ .../mian/gitnex/activities/EditIssueActivity.java | 13 +++++++++++++ .../activities/MergePullRequestActivity.java | 5 +++++ .../mian/gitnex/adapters/IssueCommentsAdapter.java | 3 ++- app/src/main/res/layout/activity_create_issue.xml | 1 + app/src/main/res/layout/activity_create_pr.xml | 1 + .../main/res/layout/activity_create_release.xml | 1 + app/src/main/res/layout/activity_edit_issue.xml | 1 + app/src/main/res/layout/activity_new_file.xml | 1 + app/src/main/res/layout/activity_new_milestone.xml | 1 + .../main/res/layout/activity_new_organization.xml | 1 + app/src/main/res/values/strings.xml | 1 + 17 files changed, 112 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java index 6392f8d2..b03d8100 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateFileActivity.java @@ -1,8 +1,10 @@ package org.mian.gitnex.activities; +import android.annotation.SuppressLint; import android.content.Context; import android.os.Bundle; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; @@ -66,6 +68,7 @@ public class CreateFileActivity extends BaseActivity { return R.layout.activity_new_file; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -101,6 +104,17 @@ public class CreateFileActivity extends BaseActivity { newFileCreate = findViewById(R.id.newFileCreate); + newFileContent.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + if(getIntent().getStringExtra("filePath") != null && getIntent().getIntExtra("fileAction", 1) == 1) { fileAction = getIntent().getIntExtra("fileAction", 1); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java index bfccc574..7c235cf7 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java @@ -1,5 +1,6 @@ package org.mian.gitnex.activities; +import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; @@ -7,6 +8,7 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; @@ -79,6 +81,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis return R.layout.activity_create_issue; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -113,6 +116,17 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis assert imm != null; imm.showSoftInput(viewBinding.newIssueTitle, InputMethodManager.SHOW_IMPLICIT); + viewBinding.newIssueDescription.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + labelsAdapter = new LabelsListAdapter(labelsList, CreateIssueActivity.this, labelsIds); assigneesAdapter = new AssigneesListAdapter(ctx, assigneesList, CreateIssueActivity.this, assigneesListData); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java index e81a42c5..b8c5cce2 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java @@ -1,9 +1,11 @@ package org.mian.gitnex.activities; +import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.content.Context; import android.os.Bundle; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; @@ -43,6 +45,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic return R.layout.activity_new_milestone; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -63,6 +66,17 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic assert imm != null; imm.showSoftInput(milestoneTitle, InputMethodManager.SHOW_IMPLICIT); + milestoneDescription.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + initCloseListener(); closeActivity.setOnClickListener(onClickListener); milestoneDueDate.setOnClickListener(this); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java index 4a55c5bb..e61b7bc6 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateOrganizationActivity.java @@ -1,8 +1,10 @@ package org.mian.gitnex.activities; +import android.annotation.SuppressLint; import android.content.Context; import android.os.Bundle; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; @@ -40,6 +42,7 @@ public class CreateOrganizationActivity extends BaseActivity { return R.layout.activity_new_organization; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -58,6 +61,17 @@ public class CreateOrganizationActivity extends BaseActivity { assert imm != null; imm.showSoftInput(orgName, InputMethodManager.SHOW_IMPLICIT); + orgDesc.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + initCloseListener(); closeActivity.setOnClickListener(onClickListener); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java index 21cb773e..a3d3abcf 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java @@ -1,5 +1,6 @@ package org.mian.gitnex.activities; +import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; @@ -7,6 +8,7 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageView; @@ -73,6 +75,7 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis return R.layout.activity_create_pr; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -98,6 +101,17 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances; } + viewBinding.prBody.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + labelsAdapter = new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds); ImageView closeActivity = findViewById(R.id.close); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java index 7d8ca793..dcf1bbd0 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java @@ -1,8 +1,10 @@ package org.mian.gitnex.activities; +import android.annotation.SuppressLint; import android.content.Context; import android.os.Bundle; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; @@ -59,6 +61,7 @@ public class CreateReleaseActivity extends BaseActivity { return R.layout.activity_create_release; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -89,6 +92,17 @@ public class CreateReleaseActivity extends BaseActivity { assert imm != null; imm.showSoftInput(releaseTitle, InputMethodManager.SHOW_IMPLICIT); + releaseContent.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + initCloseListener(); closeActivity.setOnClickListener(onClickListener); diff --git a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java index 1a6bbd42..8df68c2c 100644 --- a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java @@ -7,6 +7,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; @@ -72,6 +73,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe return R.layout.activity_edit_issue; } + @SuppressLint("ClickableViewAccessibility") @Override public void onCreate(Bundle savedInstanceState) { @@ -107,6 +109,17 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe assert imm != null; imm.showSoftInput(editIssueTitle, InputMethodManager.SHOW_IMPLICIT); + editIssueDescription.setOnTouchListener((touchView, motionEvent) -> { + + touchView.getParent().requestDisallowInterceptTouchEvent(true); + + if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) { + + touchView.getParent().requestDisallowInterceptTouchEvent(false); + } + return false; + }); + editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner); initCloseListener(); diff --git a/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java b/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java index 14f36b56..97289bef 100644 --- a/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/MergePullRequestActivity.java @@ -249,6 +249,11 @@ public class MergePullRequestActivity extends BaseActivity { enableProcessButton(); Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg)); } + else if(response.code() == 405) { + + enableProcessButton(); + Toasty.warning(ctx, getString(R.string.mergeNotAllowed));; + } else { enableProcessButton(); diff --git a/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java index c2443b26..6aecb473 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/IssueCommentsAdapter.java @@ -15,6 +15,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.bottomsheet.BottomSheetDialog; @@ -351,7 +352,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter diff --git a/app/src/main/res/layout/activity_create_pr.xml b/app/src/main/res/layout/activity_create_pr.xml index a327e8c0..4ada13b1 100644 --- a/app/src/main/res/layout/activity_create_pr.xml +++ b/app/src/main/res/layout/activity_create_pr.xml @@ -103,6 +103,7 @@ android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" android:gravity="top|start" + android:scrollbars="vertical" android:textSize="16sp" /> diff --git a/app/src/main/res/layout/activity_create_release.xml b/app/src/main/res/layout/activity_create_release.xml index 0125dce3..563fc877 100644 --- a/app/src/main/res/layout/activity_create_release.xml +++ b/app/src/main/res/layout/activity_create_release.xml @@ -125,6 +125,7 @@ android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" android:gravity="top|start" + android:scrollbars="vertical" android:textSize="16sp" /> diff --git a/app/src/main/res/layout/activity_edit_issue.xml b/app/src/main/res/layout/activity_edit_issue.xml index 0b933c23..5da5e64f 100644 --- a/app/src/main/res/layout/activity_edit_issue.xml +++ b/app/src/main/res/layout/activity_edit_issue.xml @@ -100,6 +100,7 @@ android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" android:gravity="top|start" + android:scrollbars="vertical" android:textSize="16sp" /> diff --git a/app/src/main/res/layout/activity_new_file.xml b/app/src/main/res/layout/activity_new_file.xml index ce8247f8..939a21b3 100644 --- a/app/src/main/res/layout/activity_new_file.xml +++ b/app/src/main/res/layout/activity_new_file.xml @@ -103,6 +103,7 @@ android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" android:gravity="top|start" + android:scrollbars="vertical" android:textSize="16sp" /> diff --git a/app/src/main/res/layout/activity_new_milestone.xml b/app/src/main/res/layout/activity_new_milestone.xml index 99951310..b3d80c5f 100644 --- a/app/src/main/res/layout/activity_new_milestone.xml +++ b/app/src/main/res/layout/activity_new_milestone.xml @@ -103,6 +103,7 @@ android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" android:gravity="top|start" + android:scrollbars="vertical" android:textSize="16sp" /> diff --git a/app/src/main/res/layout/activity_new_organization.xml b/app/src/main/res/layout/activity_new_organization.xml index 87a54634..f81bfe51 100644 --- a/app/src/main/res/layout/activity_new_organization.xml +++ b/app/src/main/res/layout/activity_new_organization.xml @@ -103,6 +103,7 @@ android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" android:gravity="top|start" + android:scrollbars="vertical" android:textSize="16sp" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fb717c5d..c326f141 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -577,6 +577,7 @@ Squash and Merge Merge Strategy Select merge strategy + Not allowed to merge [Reason: Does not have enough approvals] Download This File Please wait for the file to load to memory