mirror of https://codeberg.org/gitnex/GitNex.git
Refactor update merge request screen
This commit is contained in:
parent
e2c4eb5b36
commit
448ffc88d4
|
@ -48,7 +48,8 @@
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"/>
|
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.EditIssueActivity"
|
android:name=".activities.EditIssueActivity"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"/>
|
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"
|
||||||
|
android:windowSoftInputMode="adjustResize"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.CreateNewUserActivity"
|
android:name=".activities.CreateNewUserActivity"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"
|
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|keyboard|keyboardHidden|navigation"
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DatePickerDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
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.Menu;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import com.google.android.material.datepicker.MaterialDatePicker;
|
||||||
import com.vdurmont.emoji.EmojiParser;
|
import com.vdurmont.emoji.EmojiParser;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -25,7 +21,9 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.TimeZone;
|
||||||
import org.gitnex.tea4j.v2.models.EditIssueOption;
|
import org.gitnex.tea4j.v2.models.EditIssueOption;
|
||||||
import org.gitnex.tea4j.v2.models.Issue;
|
import org.gitnex.tea4j.v2.models.Issue;
|
||||||
import org.gitnex.tea4j.v2.models.Milestone;
|
import org.gitnex.tea4j.v2.models.Milestone;
|
||||||
|
@ -35,10 +33,9 @@ import org.mian.gitnex.databinding.ActivityEditIssueBinding;
|
||||||
import org.mian.gitnex.fragments.IssuesFragment;
|
import org.mian.gitnex.fragments.IssuesFragment;
|
||||||
import org.mian.gitnex.fragments.PullRequestsFragment;
|
import org.mian.gitnex.fragments.PullRequestsFragment;
|
||||||
import org.mian.gitnex.helpers.AlertDialogs;
|
import org.mian.gitnex.helpers.AlertDialogs;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
|
||||||
import org.mian.gitnex.helpers.Constants;
|
import org.mian.gitnex.helpers.Constants;
|
||||||
import org.mian.gitnex.helpers.Markdown;
|
import org.mian.gitnex.helpers.Markdown;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
import org.mian.gitnex.helpers.contexts.IssueContext;
|
import org.mian.gitnex.helpers.contexts.IssueContext;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
@ -46,15 +43,12 @@ import retrofit2.Callback;
|
||||||
/**
|
/**
|
||||||
* @author M M Arif
|
* @author M M Arif
|
||||||
*/
|
*/
|
||||||
public class EditIssueActivity extends BaseActivity implements View.OnClickListener {
|
public class EditIssueActivity extends BaseActivity {
|
||||||
|
|
||||||
private ActivityEditIssueBinding binding;
|
private ActivityEditIssueBinding binding;
|
||||||
private final String msState = "open";
|
private final String msState = "open";
|
||||||
private final LinkedHashMap<String, Milestone> milestonesList = new LinkedHashMap<>();
|
private final LinkedHashMap<String, Milestone> milestonesList = new LinkedHashMap<>();
|
||||||
private View.OnClickListener onClickListener;
|
|
||||||
private int resultLimit;
|
|
||||||
private int milestoneId = 0;
|
private int milestoneId = 0;
|
||||||
private Date currentDate = null;
|
|
||||||
private IssueContext issue;
|
private IssueContext issue;
|
||||||
private boolean renderMd = false;
|
private boolean renderMd = false;
|
||||||
|
|
||||||
|
@ -66,17 +60,16 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
|
|
||||||
binding = ActivityEditIssueBinding.inflate(getLayoutInflater());
|
binding = ActivityEditIssueBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
setSupportActionBar(binding.toolbar);
|
|
||||||
|
|
||||||
InputMethodManager imm =
|
int resultLimit = Constants.getCurrentResultLimit(ctx);
|
||||||
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
||||||
|
|
||||||
resultLimit = Constants.getCurrentResultLimit(ctx);
|
|
||||||
issue = IssueContext.fromIntent(getIntent());
|
issue = IssueContext.fromIntent(getIntent());
|
||||||
|
|
||||||
binding.editIssueTitle.requestFocus();
|
binding.topAppBar.setNavigationOnClickListener(v -> finish());
|
||||||
assert imm != null;
|
|
||||||
imm.showSoftInput(binding.editIssueTitle, InputMethodManager.SHOW_IMPLICIT);
|
MenuItem attachment = binding.topAppBar.getMenu().getItem(0);
|
||||||
|
MenuItem create = binding.topAppBar.getMenu().getItem(2);
|
||||||
|
attachment.setVisible(false);
|
||||||
|
create.setTitle(getString(R.string.menuEditText));
|
||||||
|
|
||||||
binding.editIssueDescription.setOnTouchListener(
|
binding.editIssueDescription.setOnTouchListener(
|
||||||
(touchView, motionEvent) -> {
|
(touchView, motionEvent) -> {
|
||||||
|
@ -90,23 +83,51 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
initCloseListener();
|
|
||||||
binding.close.setOnClickListener(onClickListener);
|
|
||||||
|
|
||||||
binding.editIssueDueDate.setOnClickListener(this);
|
|
||||||
binding.editIssueButton.setOnClickListener(this);
|
|
||||||
|
|
||||||
if (issue.getIssueType().equalsIgnoreCase("Pull")) {
|
if (issue.getIssueType().equalsIgnoreCase("Pull")) {
|
||||||
|
binding.topAppBar.setTitle(
|
||||||
binding.toolbarTitle.setText(
|
|
||||||
getString(R.string.editPrNavHeader, String.valueOf(issue.getIssueIndex())));
|
getString(R.string.editPrNavHeader, String.valueOf(issue.getIssueIndex())));
|
||||||
} else {
|
} else {
|
||||||
|
binding.topAppBar.setTitle(
|
||||||
binding.toolbarTitle.setText(
|
|
||||||
getString(R.string.editIssueNavHeader, String.valueOf(issue.getIssueIndex())));
|
getString(R.string.editIssueNavHeader, String.valueOf(issue.getIssueIndex())));
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
showDatePickerDialog();
|
||||||
|
|
||||||
|
binding.topAppBar.setOnMenuItemClickListener(
|
||||||
|
menuItem -> {
|
||||||
|
int id = menuItem.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.markdown) {
|
||||||
|
|
||||||
|
if (!renderMd) {
|
||||||
|
|
||||||
|
Markdown.render(
|
||||||
|
ctx,
|
||||||
|
EmojiParser.parseToUnicode(
|
||||||
|
Objects.requireNonNull(
|
||||||
|
binding.editIssueDescription.getText())
|
||||||
|
.toString()),
|
||||||
|
binding.markdownPreview,
|
||||||
|
issue.getRepository());
|
||||||
|
|
||||||
|
binding.markdownPreview.setVisibility(View.VISIBLE);
|
||||||
|
binding.editIssueDescriptionLayout.setVisibility(View.GONE);
|
||||||
|
renderMd = true;
|
||||||
|
} else {
|
||||||
|
binding.markdownPreview.setVisibility(View.GONE);
|
||||||
|
binding.editIssueDescriptionLayout.setVisibility(View.VISIBLE);
|
||||||
|
renderMd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else if (id == R.id.create) {
|
||||||
|
processEditIssue();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.onOptionsItemSelected(menuItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
getIssue(
|
getIssue(
|
||||||
issue.getRepository().getOwner(),
|
issue.getRepository().getOwner(),
|
||||||
issue.getRepository().getName(),
|
issue.getRepository().getName(),
|
||||||
|
@ -119,81 +140,29 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
|
||||||
|
|
||||||
onClickListener = view -> finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
|
||||||
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
|
||||||
inflater.inflate(R.menu.markdown_switcher, menu);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
|
|
||||||
int id = item.getItemId();
|
|
||||||
|
|
||||||
if (id == R.id.markdown) {
|
|
||||||
|
|
||||||
if (!renderMd) {
|
|
||||||
|
|
||||||
Markdown.render(
|
|
||||||
ctx,
|
|
||||||
EmojiParser.parseToUnicode(
|
|
||||||
Objects.requireNonNull(binding.editIssueDescription.getText())
|
|
||||||
.toString()),
|
|
||||||
binding.markdownPreview,
|
|
||||||
issue.getRepository());
|
|
||||||
|
|
||||||
binding.markdownPreview.setVisibility(View.VISIBLE);
|
|
||||||
binding.editIssueDescriptionLayout.setVisibility(View.GONE);
|
|
||||||
renderMd = true;
|
|
||||||
} else {
|
|
||||||
binding.markdownPreview.setVisibility(View.GONE);
|
|
||||||
binding.editIssueDescriptionLayout.setVisibility(View.VISIBLE);
|
|
||||||
renderMd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processEditIssue() {
|
private void processEditIssue() {
|
||||||
|
|
||||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
|
||||||
|
|
||||||
String editIssueTitleForm =
|
String editIssueTitleForm =
|
||||||
Objects.requireNonNull(binding.editIssueTitle.getText()).toString();
|
Objects.requireNonNull(binding.editIssueTitle.getText()).toString();
|
||||||
String editIssueDescriptionForm =
|
String editIssueDescriptionForm =
|
||||||
Objects.requireNonNull(binding.editIssueDescription.getText()).toString();
|
Objects.requireNonNull(binding.editIssueDescription.getText()).toString();
|
||||||
|
String dueDate = Objects.requireNonNull(binding.editIssueDueDate.getText()).toString();
|
||||||
if (!connToInternet) {
|
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editIssueTitleForm.equals("")) {
|
if (editIssueTitleForm.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.issueTitleEmpty));
|
SnackBar.error(
|
||||||
|
ctx, findViewById(android.R.id.content), getString(R.string.issueTitleEmpty));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
|
||||||
editIssue(
|
editIssue(
|
||||||
issue.getRepository().getOwner(),
|
issue.getRepository().getOwner(),
|
||||||
issue.getRepository().getName(),
|
issue.getRepository().getName(),
|
||||||
issue.getIssueIndex(),
|
issue.getIssueIndex(),
|
||||||
editIssueTitleForm,
|
editIssueTitleForm,
|
||||||
editIssueDescriptionForm,
|
editIssueDescriptionForm,
|
||||||
milestoneId);
|
milestoneId,
|
||||||
|
dueDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editIssue(
|
private void editIssue(
|
||||||
|
@ -202,12 +171,21 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
int issueIndex,
|
int issueIndex,
|
||||||
String title,
|
String title,
|
||||||
String description,
|
String description,
|
||||||
int milestoneId) {
|
int milestoneId,
|
||||||
|
String dueDate) {
|
||||||
|
|
||||||
EditIssueOption issueData = new EditIssueOption();
|
EditIssueOption issueData = new EditIssueOption();
|
||||||
issueData.setTitle(title);
|
issueData.setTitle(title);
|
||||||
issueData.setBody(description);
|
issueData.setBody(description);
|
||||||
issueData.setDueDate(currentDate);
|
String[] date = dueDate.split("-");
|
||||||
|
if (!dueDate.equalsIgnoreCase("")) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.set(Calendar.YEAR, Integer.parseInt(date[0]));
|
||||||
|
calendar.set(Calendar.MONTH, Integer.parseInt(date[1]));
|
||||||
|
calendar.set(Calendar.DATE, Integer.parseInt(date[2]));
|
||||||
|
Date dueDate_ = calendar.getTime();
|
||||||
|
issueData.setDueDate(dueDate_);
|
||||||
|
}
|
||||||
issueData.setMilestone((long) milestoneId);
|
issueData.setMilestone((long) milestoneId);
|
||||||
|
|
||||||
Call<Issue> call =
|
Call<Issue> call =
|
||||||
|
@ -215,7 +193,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
.issueEditIssue(repoOwner, repoName, (long) issueIndex, issueData);
|
.issueEditIssue(repoOwner, repoName, (long) issueIndex, issueData);
|
||||||
|
|
||||||
call.enqueue(
|
call.enqueue(
|
||||||
new Callback<Issue>() {
|
new Callback<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(
|
public void onResponse(
|
||||||
|
@ -226,10 +204,16 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
|
|
||||||
if (issue.getIssueType().equalsIgnoreCase("Pull")) {
|
if (issue.getIssueType().equalsIgnoreCase("Pull")) {
|
||||||
|
|
||||||
Toasty.success(ctx, getString(R.string.editPrSuccessMessage));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.editPrSuccessMessage));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Toasty.success(ctx, getString(R.string.editIssueSuccessMessage));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.editIssueSuccessMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent result = new Intent();
|
Intent result = new Intent();
|
||||||
|
@ -238,57 +222,44 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
PullRequestsFragment.resumePullRequests =
|
PullRequestsFragment.resumePullRequests =
|
||||||
issue.getIssue().getPullRequest() != null;
|
issue.getIssue().getPullRequest() != null;
|
||||||
setResult(200, result);
|
setResult(200, result);
|
||||||
finish();
|
new Handler().postDelayed(() -> finish(), 3000);
|
||||||
} else if (response.code() == 401) {
|
} else if (response.code() == 401) {
|
||||||
|
|
||||||
enableProcessButton();
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<Issue> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<Issue> call, @NonNull Throwable t) {}
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
|
||||||
enableProcessButton();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void showDatePickerDialog() {
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
if (v == binding.editIssueDueDate) {
|
MaterialDatePicker.Builder<Long> builder = MaterialDatePicker.Builder.datePicker();
|
||||||
|
builder.setSelection(Calendar.getInstance().getTimeInMillis());
|
||||||
|
builder.setTitleText(R.string.newIssueDueDateTitle);
|
||||||
|
MaterialDatePicker<Long> materialDatePicker = builder.build();
|
||||||
|
|
||||||
final Calendar c = Calendar.getInstance();
|
binding.editIssueDueDate.setOnClickListener(
|
||||||
int mYear = c.get(Calendar.YEAR);
|
v -> materialDatePicker.show(getSupportFragmentManager(), "DATE_PICKER"));
|
||||||
final int mMonth = c.get(Calendar.MONTH);
|
|
||||||
final int mDay = c.get(Calendar.DAY_OF_MONTH);
|
|
||||||
|
|
||||||
DatePickerDialog datePickerDialog =
|
materialDatePicker.addOnPositiveButtonClickListener(
|
||||||
new DatePickerDialog(
|
selection -> {
|
||||||
this,
|
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
(view, year, monthOfYear, dayOfMonth) -> {
|
calendar.setTimeInMillis(selection);
|
||||||
binding.editIssueDueDate.setText(
|
SimpleDateFormat format =
|
||||||
getString(
|
new SimpleDateFormat(
|
||||||
R.string.setDueDate,
|
"yyyy-MM-dd", new Locale(tinyDB.getString("locale")));
|
||||||
year,
|
String formattedDate = format.format(calendar.getTime());
|
||||||
(monthOfYear + 1),
|
binding.editIssueDueDate.setText(formattedDate);
|
||||||
dayOfMonth));
|
});
|
||||||
currentDate = new Date(year - 1900, monthOfYear, dayOfMonth);
|
|
||||||
},
|
|
||||||
mYear,
|
|
||||||
mMonth,
|
|
||||||
mDay);
|
|
||||||
datePickerDialog.show();
|
|
||||||
} else if (v == binding.editIssueButton) {
|
|
||||||
|
|
||||||
processEditIssue();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getIssue(
|
private void getIssue(
|
||||||
|
@ -431,8 +402,6 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
500);
|
500);
|
||||||
|
|
||||||
enableProcessButton();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,35 +423,27 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
||||||
String dueDate = formatter.format(response.body().getDueDate());
|
String dueDate = formatter.format(response.body().getDueDate());
|
||||||
binding.editIssueDueDate.setText(dueDate);
|
binding.editIssueDueDate.setText(dueDate);
|
||||||
}
|
}
|
||||||
// enableProcessButton();
|
|
||||||
|
|
||||||
} else if (response.code() == 401) {
|
} else if (response.code() == 401) {
|
||||||
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
SnackBar.error(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<Issue> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<Issue> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
// Log.e("onFailure", t.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
|
||||||
|
|
||||||
binding.editIssueButton.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableProcessButton() {
|
|
||||||
|
|
||||||
binding.editIssueButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -17,9 +17,8 @@ import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.databinding.ActivityMergePullRequestBinding;
|
import org.mian.gitnex.databinding.ActivityMergePullRequestBinding;
|
||||||
import org.mian.gitnex.fragments.PullRequestsFragment;
|
import org.mian.gitnex.fragments.PullRequestsFragment;
|
||||||
import org.mian.gitnex.helpers.AlertDialogs;
|
import org.mian.gitnex.helpers.AlertDialogs;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
|
||||||
import org.mian.gitnex.helpers.MergePullRequestSpinner;
|
import org.mian.gitnex.helpers.MergePullRequestSpinner;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
import org.mian.gitnex.helpers.contexts.IssueContext;
|
import org.mian.gitnex.helpers.contexts.IssueContext;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
@ -29,11 +28,9 @@ import retrofit2.Callback;
|
||||||
*/
|
*/
|
||||||
public class MergePullRequestActivity extends BaseActivity {
|
public class MergePullRequestActivity extends BaseActivity {
|
||||||
|
|
||||||
private View.OnClickListener onClickListener;
|
|
||||||
private IssueContext issue;
|
private IssueContext issue;
|
||||||
private ActivityMergePullRequestBinding viewBinding;
|
private ActivityMergePullRequestBinding viewBinding;
|
||||||
private String Do;
|
private String Do;
|
||||||
private final View.OnClickListener mergePullRequest = v -> processMergePullRequest();
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,26 +43,22 @@ public class MergePullRequestActivity extends BaseActivity {
|
||||||
|
|
||||||
issue = IssueContext.fromIntent(getIntent());
|
issue = IssueContext.fromIntent(getIntent());
|
||||||
|
|
||||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
|
||||||
|
|
||||||
InputMethodManager imm =
|
|
||||||
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
||||||
|
|
||||||
viewBinding.mergeTitle.requestFocus();
|
|
||||||
assert imm != null;
|
|
||||||
imm.showSoftInput(viewBinding.mergeTitle, InputMethodManager.SHOW_IMPLICIT);
|
|
||||||
|
|
||||||
setMergeAdapter();
|
setMergeAdapter();
|
||||||
|
|
||||||
if (!issue.getPullRequest().getTitle().isEmpty()) {
|
if (!issue.getPullRequest().getTitle().isEmpty()) {
|
||||||
|
viewBinding.topAppBar.setTitle(issue.getPullRequest().getTitle());
|
||||||
viewBinding.toolbarTitle.setText(issue.getPullRequest().getTitle());
|
|
||||||
viewBinding.mergeTitle.setText(
|
viewBinding.mergeTitle.setText(
|
||||||
issue.getPullRequest().getTitle() + " (#" + issue.getIssueIndex() + ")");
|
issue.getPullRequest().getTitle() + " (#" + issue.getIssueIndex() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
initCloseListener();
|
viewBinding.topAppBar.setNavigationOnClickListener(v -> finish());
|
||||||
viewBinding.close.setOnClickListener(onClickListener);
|
|
||||||
|
MenuItem attachment = viewBinding.topAppBar.getMenu().getItem(0);
|
||||||
|
MenuItem markdown = viewBinding.topAppBar.getMenu().getItem(1);
|
||||||
|
MenuItem create = viewBinding.topAppBar.getMenu().getItem(2);
|
||||||
|
attachment.setVisible(false);
|
||||||
|
markdown.setVisible(false);
|
||||||
|
create.setTitle(getString(R.string.mergePullRequestButtonText));
|
||||||
|
|
||||||
// if gitea version is greater/equal(1.12.0) than user installed version
|
// if gitea version is greater/equal(1.12.0) than user installed version
|
||||||
// (installed.higherOrEqual(compareVer))
|
// (installed.higherOrEqual(compareVer))
|
||||||
|
@ -75,36 +68,37 @@ public class MergePullRequestActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!issue.getPullRequest().isMergeable()) {
|
if (!issue.getPullRequest().isMergeable()) {
|
||||||
|
|
||||||
disableProcessButton();
|
|
||||||
viewBinding.mergeInfoDisabledMessage.setVisibility(View.VISIBLE);
|
viewBinding.mergeInfoDisabledMessage.setVisibility(View.VISIBLE);
|
||||||
|
create.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
viewBinding.mergeInfoDisabledMessage.setVisibility(View.GONE);
|
viewBinding.mergeInfoDisabledMessage.setVisibility(View.GONE);
|
||||||
|
create.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (issue.prIsFork()) {
|
if (issue.prIsFork()) {
|
||||||
|
|
||||||
viewBinding.deleteBranchForkInfo.setVisibility(View.VISIBLE);
|
viewBinding.deleteBranchForkInfo.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
viewBinding.deleteBranchForkInfo.setVisibility(View.GONE);
|
viewBinding.deleteBranchForkInfo.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!connToInternet) {
|
|
||||||
|
|
||||||
disableProcessButton();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
viewBinding.mergeButton.setOnClickListener(mergePullRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(issue.getPullRequest().getHead().getRepo() != null
|
if (!(issue.getPullRequest().getHead().getRepo() != null
|
||||||
? issue.getPullRequest().getHead().getRepo().getPermissions().isPush()
|
? issue.getPullRequest().getHead().getRepo().getPermissions().isPush()
|
||||||
: false)) {
|
: false)) {
|
||||||
viewBinding.deleteBranch.setVisibility(View.GONE);
|
viewBinding.deleteBranch.setVisibility(View.GONE);
|
||||||
viewBinding.deleteBranchForkInfo.setVisibility(View.GONE);
|
viewBinding.deleteBranchForkInfo.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewBinding.topAppBar.setOnMenuItemClickListener(
|
||||||
|
menuItem -> {
|
||||||
|
int id = menuItem.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.create) {
|
||||||
|
processMergePullRequest();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.onOptionsItemSelected(menuItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMergeAdapter() {
|
private void setMergeAdapter() {
|
||||||
|
@ -140,11 +134,6 @@ public class MergePullRequestActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
|
||||||
|
|
||||||
onClickListener = view -> finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processMergePullRequest() {
|
private void processMergePullRequest() {
|
||||||
|
|
||||||
String mergePRDesc =
|
String mergePRDesc =
|
||||||
|
@ -152,20 +141,14 @@ public class MergePullRequestActivity extends BaseActivity {
|
||||||
String mergePRTitle = Objects.requireNonNull(viewBinding.mergeTitle.getText()).toString();
|
String mergePRTitle = Objects.requireNonNull(viewBinding.mergeTitle.getText()).toString();
|
||||||
boolean deleteBranch = viewBinding.deleteBranch.isChecked();
|
boolean deleteBranch = viewBinding.deleteBranch.isChecked();
|
||||||
|
|
||||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
|
||||||
|
|
||||||
if (!connToInternet) {
|
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Do == null) {
|
if (Do == null) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.selectMergeStrategy));
|
SnackBar.error(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.selectMergeStrategy));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
disableProcessButton();
|
|
||||||
mergeFunction(Do, mergePRDesc, mergePRTitle, deleteBranch);
|
mergeFunction(Do, mergePRDesc, mergePRTitle, deleteBranch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,49 +220,46 @@ public class MergePullRequestActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Toasty.success(ctx, getString(R.string.mergePRSuccessMsg));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.mergePRSuccessMsg));
|
||||||
|
|
||||||
Intent result = new Intent();
|
Intent result = new Intent();
|
||||||
PullRequestsFragment.resumePullRequests = true;
|
PullRequestsFragment.resumePullRequests = true;
|
||||||
IssueDetailActivity.singleIssueUpdate = true;
|
IssueDetailActivity.singleIssueUpdate = true;
|
||||||
RepoDetailActivity.updateRepo = true;
|
RepoDetailActivity.updateRepo = true;
|
||||||
setResult(200, result);
|
setResult(200, result);
|
||||||
finish();
|
new Handler().postDelayed(() -> finish(), 3000);
|
||||||
} else if (response.code() == 401) {
|
} else if (response.code() == 401) {
|
||||||
|
|
||||||
enableProcessButton();
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
||||||
} else if (response.code() == 404) {
|
} else if (response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.mergePR404ErrorMsg));
|
||||||
} else if (response.code() == 405) {
|
} else if (response.code() == 405) {
|
||||||
|
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.warning(ctx, getString(R.string.mergeNotAllowed));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.mergeNotAllowed));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {}
|
||||||
enableProcessButton();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
|
||||||
|
|
||||||
viewBinding.mergeButton.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableProcessButton() {
|
|
||||||
|
|
||||||
viewBinding.mergeButton.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
android:id="@+id/addCollaboratorSearchLayout"
|
android:id="@+id/addCollaboratorSearchLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:hintTextColor="?attr/hintColor"
|
app:hintTextColor="?attr/hintColor"
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
|
|
|
@ -1,61 +1,50 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/primaryBackgroundColor"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
android:orientation="vertical">
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appBarLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/Widget.AppCompat.SearchView"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
app:elevation="@dimen/dimen0dp">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:id="@+id/toolbar"
|
style="?attr/collapsingToolbarLayoutLargeStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
app:contentScrim="?attr/primaryBackgroundColor"
|
||||||
|
android:layout_height="?attr/collapsingToolbarLayoutLargeSize">
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/close"
|
android:id="@+id/topAppBar"
|
||||||
android:layout_width="@dimen/dimen26dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dimen26dp"
|
android:elevation="0dp"
|
||||||
android:layout_marginStart="@dimen/dimen16dp"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_marginEnd="@dimen/dimen16dp"
|
app:title="@string/editIssueNavHeader"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
app:layout_collapseMode="pin"
|
||||||
android:clickable="true"
|
app:menu="@menu/create_issue_menu"
|
||||||
android:contentDescription="@string/close"
|
app:navigationIcon="@drawable/ic_close" />
|
||||||
android:focusable="true"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_close"/>
|
|
||||||
|
|
||||||
<TextView
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
android:id="@+id/toolbar_title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/editIssueNavHeader"
|
|
||||||
android:textColor="?attr/primaryTextColor"
|
|
||||||
android:textSize="@dimen/dimen20sp"/>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<ScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="@dimen/dimen16dp">
|
android:padding="@dimen/dimen16dp">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/editIssueTitleLayout"
|
android:id="@+id/editIssueTitleLayout"
|
||||||
|
@ -65,7 +54,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newIssueTitle"
|
android:hint="@string/newIssueTitle"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -93,7 +81,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newIssueDescriptionTitle"
|
android:hint="@string/newIssueDescriptionTitle"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -134,7 +121,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newIssueMilestoneTitle"
|
android:hint="@string/newIssueMilestoneTitle"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
app:hintTextColor="?attr/hintColor">
|
app:hintTextColor="?attr/hintColor">
|
||||||
|
|
||||||
|
@ -157,7 +143,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newIssueDueDateTitle"
|
android:hint="@string/newIssueDueDateTitle"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -176,17 +161,8 @@
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/editIssueButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dimen54dp"
|
|
||||||
android:layout_marginTop="@dimen/dimen8dp"
|
|
||||||
android:text="@string/saveButton"
|
|
||||||
android:textColor="?attr/materialCardBackgroundColor"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -1,72 +1,50 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/primaryBackgroundColor"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
android:orientation="vertical">
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appBarLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/Widget.AppCompat.SearchView"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
app:elevation="@dimen/dimen0dp">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:id="@+id/toolbar"
|
style="?attr/collapsingToolbarLayoutLargeStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
app:contentScrim="?attr/primaryBackgroundColor"
|
||||||
|
android:layout_height="?attr/collapsingToolbarLayoutLargeSize">
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/close"
|
android:id="@+id/topAppBar"
|
||||||
android:layout_width="@dimen/dimen26dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dimen26dp"
|
android:elevation="0dp"
|
||||||
android:layout_marginStart="@dimen/dimen16dp"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_marginEnd="@dimen/dimen16dp"
|
app:title="@string/mergePullRequestButtonText"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
app:layout_collapseMode="pin"
|
||||||
android:clickable="true"
|
app:menu="@menu/create_issue_menu"
|
||||||
android:contentDescription="@string/close"
|
app:navigationIcon="@drawable/ic_close" />
|
||||||
android:focusable="true"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_close"/>
|
|
||||||
|
|
||||||
<HorizontalScrollView
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
android:id="@+id/replyToPRNavHeader"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dimen0dp"
|
|
||||||
android:layout_marginEnd="@dimen/dimen24dp"
|
|
||||||
android:fillViewport="true"
|
|
||||||
android:foregroundGravity="right"
|
|
||||||
android:scrollbarThumbHorizontal="@android:color/transparent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/toolbar_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="?attr/primaryTextColor"
|
|
||||||
android:textSize="@dimen/dimen20sp"/>
|
|
||||||
|
|
||||||
</HorizontalScrollView>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<ScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="@dimen/dimen16dp">
|
android:padding="@dimen/dimen16dp">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/mergeTitleLayout"
|
android:id="@+id/mergeTitleLayout"
|
||||||
|
@ -76,7 +54,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/mergePullRequestButtonText"
|
android:hint="@string/mergePullRequestButtonText"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:counterEnabled="true"
|
app:counterEnabled="true"
|
||||||
app:counterMaxLength="255"
|
app:counterMaxLength="255"
|
||||||
|
@ -95,7 +72,7 @@
|
||||||
android:textColor="?attr/inputTextColor"
|
android:textColor="?attr/inputTextColor"
|
||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:textSize="@dimen/dimen16sp"/>
|
android:textSize="@dimen/dimen16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
@ -107,7 +84,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/mergeCommentText"
|
android:hint="@string/mergeCommentText"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -122,7 +98,7 @@
|
||||||
android:textColor="?attr/inputTextColor"
|
android:textColor="?attr/inputTextColor"
|
||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:textSize="@dimen/dimen16sp"/>
|
android:textSize="@dimen/dimen16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
@ -135,7 +111,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/mergeStrategy"
|
android:hint="@string/mergeStrategy"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
app:hintTextColor="?attr/hintColor">
|
app:hintTextColor="?attr/hintColor">
|
||||||
|
|
||||||
|
@ -146,7 +121,7 @@
|
||||||
android:inputType="none"
|
android:inputType="none"
|
||||||
android:labelFor="@+id/mergeSpinner"
|
android:labelFor="@+id/mergeSpinner"
|
||||||
android:textColor="?attr/inputTextColor"
|
android:textColor="?attr/inputTextColor"
|
||||||
android:textSize="@dimen/dimen16sp"/>
|
android:textSize="@dimen/dimen16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
@ -159,17 +134,17 @@
|
||||||
android:text="@string/deleteBranchAfterMerge"
|
android:text="@string/deleteBranchAfterMerge"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="@dimen/dimen16sp"
|
android:textSize="@dimen/dimen16sp"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/deleteBranchForkInfo"
|
android:id="@+id/deleteBranchForkInfo"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dimen0dp"
|
android:layout_marginTop="@dimen/dimen10dp"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:text="@string/deleteBranchForkInfo"
|
android:text="@string/deleteBranchForkInfo"
|
||||||
android:textColor="?attr/hintColor"
|
android:textColor="?attr/hintColor"
|
||||||
android:textSize="@dimen/dimen12sp"/>
|
android:textSize="@dimen/dimen12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/mergeInfo"
|
android:id="@+id/mergeInfo"
|
||||||
|
@ -179,16 +154,7 @@
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:text="@string/mergeNoteText"
|
android:text="@string/mergeNoteText"
|
||||||
android:textColor="?attr/hintColor"
|
android:textColor="?attr/hintColor"
|
||||||
android:textSize="@dimen/dimen12sp"/>
|
android:textSize="@dimen/dimen12sp" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/mergeButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dimen54dp"
|
|
||||||
android:layout_marginTop="@dimen/dimen8dp"
|
|
||||||
android:text="@string/mergePullRequestButtonText"
|
|
||||||
android:textColor="?attr/materialCardBackgroundColor"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/mergeInfoDisabledMessage"
|
android:id="@+id/mergeInfoDisabledMessage"
|
||||||
|
@ -199,11 +165,11 @@
|
||||||
android:text="@string/mergeInfoDisabledMessage"
|
android:text="@string/mergeInfoDisabledMessage"
|
||||||
android:textColor="?attr/hintColor"
|
android:textColor="?attr/hintColor"
|
||||||
android:textSize="@dimen/dimen12sp"
|
android:textSize="@dimen/dimen12sp"
|
||||||
android:visibility="gone"/>
|
android:visibility="visible" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
android:text="@string/newIssueTitle"
|
android:text="@string/newIssueTitle"
|
||||||
android:textAlignment="gravity"
|
android:textAlignment="gravity"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/dimen16sp"
|
android:textSize="@dimen/dimen16sp"
|
||||||
tools:text="Id illum odio repellat omnis fuga deserunt aut. Ut est aut similique qui incidunt quia et." />
|
tools:text="Id illum odio repellat omnis fuga deserunt aut. Ut est aut similique qui incidunt quia et." />
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@
|
||||||
android:textAlignment="gravity"
|
android:textAlignment="gravity"
|
||||||
android:text="@string/newIssueTitle"
|
android:text="@string/newIssueTitle"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/dimen16sp" />
|
android:textSize="@dimen/dimen16sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/dimen14sp"
|
android:textSize="@dimen/dimen14sp"
|
||||||
tools:text="@string/orgName"/>
|
tools:text="@string/orgName"/>
|
||||||
|
|
||||||
|
@ -65,7 +64,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/repoName"
|
android:text="@string/repoName"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/dimen18sp"
|
android:textSize="@dimen/dimen18sp"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
|
@ -75,7 +73,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:textSize="@dimen/dimen16sp"
|
android:textSize="@dimen/dimen16sp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:text="@string/noDataDescription"/>
|
android:text="@string/noDataDescription"/>
|
||||||
|
|
Loading…
Reference in New Issue