Fix scrolling issue for textareas (#752)

Add info msg for merge 405

Fix scrolling issue for textareas

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/752
This commit is contained in:
M M Arif 2020-10-30 08:00:52 +01:00
parent 5807d11e8c
commit f111f7f2df
17 changed files with 112 additions and 1 deletions

View File

@ -1,8 +1,10 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -66,6 +68,7 @@ public class CreateFileActivity extends BaseActivity {
return R.layout.activity_new_file; return R.layout.activity_new_file;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -101,6 +104,17 @@ public class CreateFileActivity extends BaseActivity {
newFileCreate = findViewById(R.id.newFileCreate); 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) { if(getIntent().getStringExtra("filePath") != null && getIntent().getIntExtra("fileAction", 1) == 1) {
fileAction = getIntent().getIntExtra("fileAction", 1); fileAction = getIntent().getIntExtra("fileAction", 1);

View File

@ -1,5 +1,6 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
@ -7,6 +8,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -79,6 +81,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
return R.layout.activity_create_issue; return R.layout.activity_create_issue;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -113,6 +116,17 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
assert imm != null; assert imm != null;
imm.showSoftInput(viewBinding.newIssueTitle, InputMethodManager.SHOW_IMPLICIT); 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); labelsAdapter = new LabelsListAdapter(labelsList, CreateIssueActivity.this, labelsIds);
assigneesAdapter = new AssigneesListAdapter(ctx, assigneesList, CreateIssueActivity.this, assigneesListData); assigneesAdapter = new AssigneesListAdapter(ctx, assigneesList, CreateIssueActivity.this, assigneesListData);

View File

@ -1,9 +1,11 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
@ -43,6 +45,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
return R.layout.activity_new_milestone; return R.layout.activity_new_milestone;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -63,6 +66,17 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
assert imm != null; assert imm != null;
imm.showSoftInput(milestoneTitle, InputMethodManager.SHOW_IMPLICIT); 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(); initCloseListener();
closeActivity.setOnClickListener(onClickListener); closeActivity.setOnClickListener(onClickListener);
milestoneDueDate.setOnClickListener(this); milestoneDueDate.setOnClickListener(this);

View File

@ -1,8 +1,10 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
@ -40,6 +42,7 @@ public class CreateOrganizationActivity extends BaseActivity {
return R.layout.activity_new_organization; return R.layout.activity_new_organization;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -58,6 +61,17 @@ public class CreateOrganizationActivity extends BaseActivity {
assert imm != null; assert imm != null;
imm.showSoftInput(orgName, InputMethodManager.SHOW_IMPLICIT); 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(); initCloseListener();
closeActivity.setOnClickListener(onClickListener); closeActivity.setOnClickListener(onClickListener);

View File

@ -1,5 +1,6 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
@ -7,6 +8,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
@ -73,6 +75,7 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
return R.layout.activity_create_pr; return R.layout.activity_create_pr;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -98,6 +101,17 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances; 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); labelsAdapter = new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds);
ImageView closeActivity = findViewById(R.id.close); ImageView closeActivity = findViewById(R.id.close);

View File

@ -1,8 +1,10 @@
package org.mian.gitnex.activities; package org.mian.gitnex.activities;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -59,6 +61,7 @@ public class CreateReleaseActivity extends BaseActivity {
return R.layout.activity_create_release; return R.layout.activity_create_release;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -89,6 +92,17 @@ public class CreateReleaseActivity extends BaseActivity {
assert imm != null; assert imm != null;
imm.showSoftInput(releaseTitle, InputMethodManager.SHOW_IMPLICIT); 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(); initCloseListener();
closeActivity.setOnClickListener(onClickListener); closeActivity.setOnClickListener(onClickListener);

View File

@ -7,6 +7,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -72,6 +73,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
return R.layout.activity_edit_issue; return R.layout.activity_edit_issue;
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -107,6 +109,17 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
assert imm != null; assert imm != null;
imm.showSoftInput(editIssueTitle, InputMethodManager.SHOW_IMPLICIT); 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); editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
initCloseListener(); initCloseListener();

View File

@ -249,6 +249,11 @@ public class MergePullRequestActivity extends BaseActivity {
enableProcessButton(); enableProcessButton();
Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg)); Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg));
} }
else if(response.code() == 405) {
enableProcessButton();
Toasty.warning(ctx, getString(R.string.mergeNotAllowed));;
}
else { else {
enableProcessButton(); enableProcessButton();

View File

@ -15,6 +15,7 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialog;
@ -351,7 +352,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
final int resourceId = mCtx.getResources().getIdentifier(raw.substring("drawable://".length()), "drawable", mCtx.getPackageName()); final int resourceId = mCtx.getResources().getIdentifier(raw.substring("drawable://".length()), "drawable", mCtx.getPackageName());
final Drawable drawable = mCtx.getDrawable(resourceId); final Drawable drawable = ContextCompat.getDrawable(mCtx, resourceId);
assert drawable != null; assert drawable != null;
return ImageItem.withResult(drawable); return ImageItem.withResult(drawable);

View File

@ -103,6 +103,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -103,6 +103,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -125,6 +125,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -100,6 +100,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -103,6 +103,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -103,6 +103,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -103,6 +103,7 @@
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor" android:textColorHint="?attr/hintColor"
android:gravity="top|start" android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="16sp" /> android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>

View File

@ -577,6 +577,7 @@
<string name="mergeOptionSquash">Squash and Merge</string> <string name="mergeOptionSquash">Squash and Merge</string>
<string name="mergeStrategy">Merge Strategy</string> <string name="mergeStrategy">Merge Strategy</string>
<string name="selectMergeStrategy">Select merge strategy</string> <string name="selectMergeStrategy">Select merge strategy</string>
<string name="mergeNotAllowed">Not allowed to merge [Reason: Does not have enough approvals]</string>
<string name="downloadFile">Download This File</string> <string name="downloadFile">Download This File</string>
<string name="waitLoadingDownloadFile">Please wait for the file to load to memory</string> <string name="waitLoadingDownloadFile">Please wait for the file to load to memory</string>