Preview of MD for supported inputs (#1213)

Closes #487

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1213
Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
M M Arif 2023-01-19 11:55:19 +00:00
parent aac1edf071
commit a2d903cfde
32 changed files with 488 additions and 254 deletions

View File

@ -4,11 +4,11 @@ plugins {
apply plugin: 'com.android.application'
android {
compileSdkVersion 32
compileSdkVersion 33
defaultConfig {
applicationId "org.mian.gitnex"
minSdkVersion 23
targetSdkVersion 32
targetSdkVersion 33
versionCode 495
versionName "5.0.0-dev"
multiDexEnabled true
@ -42,6 +42,7 @@ android {
lint {
abortOnError false
}
namespace 'org.mian.gitnex'
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
@ -60,9 +61,9 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.compose.material3:material3:1.0.0-alpha15'
implementation 'androidx.compose.material3:material3-window-size-class:1.0.0-alpha15'
implementation 'com.google.android.material:material:1.8.0-alpha01'
implementation 'androidx.compose.material3:material3:1.0.0-beta03'
implementation 'androidx.compose.material3:material3-window-size-class:1.0.0-beta03'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
@ -78,7 +79,7 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.2.Final'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.4.Final'
implementation 'com.github.Pes8:android-material-color-picker-dialog:master'
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-latex:$markwon_version"

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.mian.gitnex">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>

View File

@ -5,6 +5,9 @@ import android.app.DatePickerDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
@ -12,6 +15,7 @@ import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.vdurmont.emoji.EmojiParser;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -36,6 +40,7 @@ import org.mian.gitnex.fragments.IssuesFragment;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call;
@ -62,6 +67,8 @@ public class CreateIssueActivity extends BaseActivity
private MaterialAlertDialogBuilder materialAlertDialogBuilder;
private List<Integer> labelsIds = new ArrayList<>();
private List<String> assigneesListData = new ArrayList<>();
private boolean renderMd = false;
private RepositoryContext repositoryContext;
@SuppressLint("ClickableViewAccessibility")
@Override
@ -71,6 +78,9 @@ public class CreateIssueActivity extends BaseActivity
viewBinding = ActivityCreateIssueBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
setSupportActionBar(viewBinding.toolbar);
repositoryContext = RepositoryContext.fromIntent(getIntent());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
@ -137,6 +147,46 @@ public class CreateIssueActivity extends BaseActivity
}
}
@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(viewBinding.newIssueDescription.getText())
.toString()),
viewBinding.markdownPreview,
repositoryContext);
viewBinding.markdownPreview.setVisibility(View.VISIBLE);
viewBinding.newIssueDescriptionLayout.setVisibility(View.GONE);
renderMd = true;
} else {
viewBinding.markdownPreview.setVisibility(View.GONE);
viewBinding.newIssueDescriptionLayout.setVisibility(View.VISIBLE);
renderMd = false;
}
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
@Override
public void assigneesInterface(List<String> data) {

View File

@ -6,15 +6,17 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.vdurmont.emoji.EmojiParser;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
import org.gitnex.tea4j.v2.models.CreateMilestoneOption;
import org.gitnex.tea4j.v2.models.Milestone;
import org.mian.gitnex.R;
@ -22,6 +24,7 @@ import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateMilestoneBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call;
@ -32,15 +35,12 @@ import retrofit2.Callback;
*/
public class CreateMilestoneActivity extends BaseActivity implements View.OnClickListener {
private EditText milestoneDueDate;
private ActivityCreateMilestoneBinding binding;
private View.OnClickListener onClickListener;
private EditText milestoneTitle;
private EditText milestoneDescription;
private Button createNewMilestoneButton;
private RepositoryContext repository;
private Date currentDate = null;
private final View.OnClickListener createMilestoneListener = v -> processNewMilestone();
private boolean renderMd = false;
@SuppressLint("ClickableViewAccessibility")
@Override
@ -48,27 +48,22 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
super.onCreate(savedInstanceState);
ActivityCreateMilestoneBinding activityCreateMilestoneBinding =
ActivityCreateMilestoneBinding.inflate(getLayoutInflater());
setContentView(activityCreateMilestoneBinding.getRoot());
binding = ActivityCreateMilestoneBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
InputMethodManager imm =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
milestoneDueDate = activityCreateMilestoneBinding.milestoneDueDate;
ImageView closeActivity = activityCreateMilestoneBinding.close;
createNewMilestoneButton = activityCreateMilestoneBinding.createNewMilestoneButton;
milestoneTitle = activityCreateMilestoneBinding.milestoneTitle;
milestoneDescription = activityCreateMilestoneBinding.milestoneDescription;
repository = RepositoryContext.fromIntent(getIntent());
milestoneTitle.requestFocus();
binding.milestoneTitle.requestFocus();
assert imm != null;
imm.showSoftInput(milestoneTitle, InputMethodManager.SHOW_IMPLICIT);
imm.showSoftInput(binding.milestoneTitle, InputMethodManager.SHOW_IMPLICIT);
milestoneDescription.setOnTouchListener(
binding.milestoneDescription.setOnTouchListener(
(touchView, motionEvent) -> {
touchView.getParent().requestDisallowInterceptTouchEvent(true);
@ -81,15 +76,56 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
});
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
milestoneDueDate.setOnClickListener(this);
binding.close.setOnClickListener(onClickListener);
binding.milestoneDueDate.setOnClickListener(this);
if (!connToInternet) {
createNewMilestoneButton.setEnabled(false);
binding.createNewMilestoneButton.setEnabled(false);
} else {
createNewMilestoneButton.setOnClickListener(createMilestoneListener);
binding.createNewMilestoneButton.setOnClickListener(createMilestoneListener);
}
}
@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(
Objects.requireNonNull(
binding.milestoneDescription.getText())
.toString())),
binding.markdownPreview);
binding.markdownPreview.setVisibility(View.VISIBLE);
binding.milestoneDescriptionLayout.setVisibility(View.GONE);
renderMd = true;
} else {
binding.markdownPreview.setVisibility(View.GONE);
binding.milestoneDescriptionLayout.setVisibility(View.VISIBLE);
renderMd = false;
}
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
@ -97,8 +133,10 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
String newMilestoneTitle = milestoneTitle.getText().toString();
String newMilestoneDescription = milestoneDescription.getText().toString();
String newMilestoneTitle =
Objects.requireNonNull(binding.milestoneTitle.getText()).toString();
String newMilestoneDescription =
Objects.requireNonNull(binding.milestoneDescription.getText()).toString();
if (!connToInternet) {
@ -188,7 +226,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
@Override
public void onClick(View v) {
if (v == milestoneDueDate) {
if (v == binding.milestoneDueDate) {
final Calendar c = Calendar.getInstance();
int mYear = c.get(Calendar.YEAR);
@ -199,7 +237,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
new DatePickerDialog(
this,
(view, year, monthOfYear, dayOfMonth) -> {
milestoneDueDate.setText(
binding.milestoneDueDate.setText(
getString(
R.string.setDueDate,
year,
@ -221,12 +259,12 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
private void disableProcessButton() {
createNewMilestoneButton.setEnabled(false);
binding.createNewMilestoneButton.setEnabled(false);
}
private void enableProcessButton() {
createNewMilestoneButton.setEnabled(true);
binding.createNewMilestoneButton.setEnabled(true);
}
@Override

View File

@ -4,6 +4,9 @@ import android.annotation.SuppressLint;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ArrayAdapter;
@ -11,6 +14,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.vdurmont.emoji.EmojiParser;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -30,6 +34,7 @@ import org.mian.gitnex.databinding.ActivityCreatePrBinding;
import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding;
import org.mian.gitnex.fragments.PullRequestsFragment;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call;
@ -53,6 +58,8 @@ public class CreatePullRequestActivity extends BaseActivity
private RepositoryContext repository;
private LabelsListAdapter labelsAdapter;
private MaterialAlertDialogBuilder materialAlertDialogBuilder;
private boolean renderMd = false;
private RepositoryContext repositoryContext;
@SuppressLint("ClickableViewAccessibility")
@Override
@ -62,6 +69,9 @@ public class CreatePullRequestActivity extends BaseActivity
viewBinding = ActivityCreatePrBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
setSupportActionBar(viewBinding.toolbar);
repositoryContext = RepositoryContext.fromIntent(getIntent());
materialAlertDialogBuilder =
new MaterialAlertDialogBuilder(ctx, R.style.ThemeOverlay_Material3_Dialog_Alert);
@ -108,6 +118,45 @@ public class CreatePullRequestActivity extends BaseActivity
}
}
@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(viewBinding.prBody.getText()).toString()),
viewBinding.markdownPreview,
repositoryContext);
viewBinding.markdownPreview.setVisibility(View.VISIBLE);
viewBinding.prBodyLayout.setVisibility(View.GONE);
renderMd = true;
} else {
viewBinding.markdownPreview.setVisibility(View.GONE);
viewBinding.prBodyLayout.setVisibility(View.VISIBLE);
renderMd = false;
}
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void processPullRequest() {
String prTitle = String.valueOf(viewBinding.prTitle.getText());

View File

@ -5,18 +5,18 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.vdurmont.emoji.EmojiParser;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.gitnex.tea4j.v2.models.Branch;
import org.gitnex.tea4j.v2.models.CreateReleaseOption;
import org.gitnex.tea4j.v2.models.CreateTagOption;
@ -27,6 +27,7 @@ import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.databinding.ActivityCreateReleaseBinding;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call;
@ -37,20 +38,13 @@ import retrofit2.Callback;
*/
public class CreateReleaseActivity extends BaseActivity {
public ImageView closeActivity;
private ActivityCreateReleaseBinding binding;
List<String> branchesList = new ArrayList<>();
private View.OnClickListener onClickListener;
private EditText releaseTagName;
private AutoCompleteTextView releaseBranch;
private EditText releaseTitle;
private EditText releaseContent;
private CheckBox releaseType;
private CheckBox releaseDraft;
private Button createNewRelease;
private String selectedBranch;
private Button createNewTag;
private RepositoryContext repository;
private final View.OnClickListener createReleaseListener = v -> processNewRelease();
private boolean renderMd = false;
@SuppressLint("ClickableViewAccessibility")
@Override
@ -58,9 +52,9 @@ public class CreateReleaseActivity extends BaseActivity {
super.onCreate(savedInstanceState);
ActivityCreateReleaseBinding activityCreateReleaseBinding =
ActivityCreateReleaseBinding.inflate(getLayoutInflater());
setContentView(activityCreateReleaseBinding.getRoot());
binding = ActivityCreateReleaseBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
@ -69,18 +63,11 @@ public class CreateReleaseActivity extends BaseActivity {
repository = RepositoryContext.fromIntent(getIntent());
closeActivity = activityCreateReleaseBinding.close;
releaseTagName = activityCreateReleaseBinding.releaseTagName;
releaseTitle = activityCreateReleaseBinding.releaseTitle;
releaseContent = activityCreateReleaseBinding.releaseContent;
releaseType = activityCreateReleaseBinding.releaseType;
releaseDraft = activityCreateReleaseBinding.releaseDraft;
releaseTitle.requestFocus();
binding.releaseTitle.requestFocus();
assert imm != null;
imm.showSoftInput(releaseTitle, InputMethodManager.SHOW_IMPLICIT);
imm.showSoftInput(binding.releaseTitle, InputMethodManager.SHOW_IMPLICIT);
releaseContent.setOnTouchListener(
binding.releaseContent.setOnTouchListener(
(touchView, motionEvent) -> {
touchView.getParent().requestDisallowInterceptTouchEvent(true);
@ -93,13 +80,10 @@ public class CreateReleaseActivity extends BaseActivity {
});
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
binding.close.setOnClickListener(onClickListener);
releaseBranch = activityCreateReleaseBinding.releaseBranch;
getBranches(repository.getOwner(), repository.getName());
createNewRelease = activityCreateReleaseBinding.createNewRelease;
createNewTag = activityCreateReleaseBinding.createNewTag;
disableProcessButton();
if (!connToInternet) {
@ -107,18 +91,60 @@ public class CreateReleaseActivity extends BaseActivity {
disableProcessButton();
} else {
createNewRelease.setOnClickListener(createReleaseListener);
binding.createNewRelease.setOnClickListener(createReleaseListener);
}
createNewTag.setOnClickListener(v -> createNewTag());
binding.createNewTag.setOnClickListener(v -> createNewTag());
}
@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(
Objects.requireNonNull(binding.releaseContent.getText())
.toString())),
binding.markdownPreview);
binding.markdownPreview.setVisibility(View.VISIBLE);
binding.releaseContentLayout.setVisibility(View.GONE);
renderMd = true;
} else {
binding.markdownPreview.setVisibility(View.GONE);
binding.releaseContentLayout.setVisibility(View.VISIBLE);
renderMd = false;
}
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void createNewTag() {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
String tagName = releaseTagName.getText().toString();
String tagName = Objects.requireNonNull(binding.releaseTagName.getText()).toString();
String message =
releaseTitle.getText().toString() + "\n\n" + releaseContent.getText().toString();
Objects.requireNonNull(binding.releaseTitle.getText()).toString()
+ "\n\n"
+ Objects.requireNonNull(binding.releaseContent.getText()).toString();
if (!connToInternet) {
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
@ -188,12 +214,14 @@ public class CreateReleaseActivity extends BaseActivity {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
String newReleaseTagName = releaseTagName.getText().toString();
String newReleaseTitle = releaseTitle.getText().toString();
String newReleaseContent = releaseContent.getText().toString();
String newReleaseTagName =
Objects.requireNonNull(binding.releaseTagName.getText()).toString();
String newReleaseTitle = Objects.requireNonNull(binding.releaseTitle.getText()).toString();
String newReleaseContent =
Objects.requireNonNull(binding.releaseContent.getText()).toString();
String checkBranch = selectedBranch;
boolean newReleaseType = releaseType.isChecked();
boolean newReleaseDraft = releaseDraft.isChecked();
boolean newReleaseType = binding.releaseType.isChecked();
boolean newReleaseDraft = binding.releaseDraft.isChecked();
if (!connToInternet) {
@ -325,10 +353,10 @@ public class CreateReleaseActivity extends BaseActivity {
R.layout.list_spinner_items,
branchesList);
releaseBranch.setAdapter(adapter);
binding.releaseBranch.setAdapter(adapter);
enableProcessButton();
releaseBranch.setOnItemClickListener(
binding.releaseBranch.setOnItemClickListener(
(parent, view, position, id) ->
selectedBranch = branchesList.get(position));
}
@ -349,13 +377,13 @@ public class CreateReleaseActivity extends BaseActivity {
}
private void disableProcessButton() {
createNewTag.setEnabled(false);
createNewRelease.setEnabled(false);
binding.createNewTag.setEnabled(false);
binding.createNewRelease.setEnabled(false);
}
private void enableProcessButton() {
createNewTag.setEnabled(true);
createNewRelease.setEnabled(true);
binding.createNewTag.setEnabled(true);
binding.createNewRelease.setEnabled(true);
}
@Override

View File

@ -8,16 +8,16 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.vdurmont.emoji.EmojiParser;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -37,6 +37,7 @@ import org.mian.gitnex.fragments.PullRequestsFragment;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.Constants;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.IssueContext;
import retrofit2.Call;
@ -47,18 +48,15 @@ import retrofit2.Callback;
*/
public class EditIssueActivity extends BaseActivity implements View.OnClickListener {
private ActivityEditIssueBinding binding;
private final String msState = "open";
private final LinkedHashMap<String, Milestone> milestonesList = new LinkedHashMap<>();
private View.OnClickListener onClickListener;
private int resultLimit;
private EditText editIssueTitle;
private EditText editIssueDescription;
private TextView editIssueDueDate;
private Button editIssueButton;
private AutoCompleteTextView editIssueMilestoneSpinner;
private int milestoneId = 0;
private Date currentDate = null;
private IssueContext issue;
private boolean renderMd = false;
@SuppressLint("ClickableViewAccessibility")
@Override
@ -66,9 +64,9 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
super.onCreate(savedInstanceState);
ActivityEditIssueBinding activityEditIssueBinding =
ActivityEditIssueBinding.inflate(getLayoutInflater());
setContentView(activityEditIssueBinding.getRoot());
binding = ActivityEditIssueBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
InputMethodManager imm =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@ -76,18 +74,11 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
resultLimit = Constants.getCurrentResultLimit(ctx);
issue = IssueContext.fromIntent(getIntent());
ImageView closeActivity = activityEditIssueBinding.close;
editIssueButton = activityEditIssueBinding.editIssueButton;
TextView toolbar_title = activityEditIssueBinding.toolbarTitle;
editIssueTitle = activityEditIssueBinding.editIssueTitle;
editIssueDescription = activityEditIssueBinding.editIssueDescription;
editIssueDueDate = activityEditIssueBinding.editIssueDueDate;
editIssueTitle.requestFocus();
binding.editIssueTitle.requestFocus();
assert imm != null;
imm.showSoftInput(editIssueTitle, InputMethodManager.SHOW_IMPLICIT);
imm.showSoftInput(binding.editIssueTitle, InputMethodManager.SHOW_IMPLICIT);
editIssueDescription.setOnTouchListener(
binding.editIssueDescription.setOnTouchListener(
(touchView, motionEvent) -> {
touchView.getParent().requestDisallowInterceptTouchEvent(true);
@ -99,21 +90,19 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
return false;
});
editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
initCloseListener();
closeActivity.setOnClickListener(onClickListener);
binding.close.setOnClickListener(onClickListener);
editIssueDueDate.setOnClickListener(this);
editIssueButton.setOnClickListener(this);
binding.editIssueDueDate.setOnClickListener(this);
binding.editIssueButton.setOnClickListener(this);
if (issue.getIssueType().equalsIgnoreCase("Pull")) {
toolbar_title.setText(
binding.toolbarTitle.setText(
getString(R.string.editPrNavHeader, String.valueOf(issue.getIssueIndex())));
} else {
toolbar_title.setText(
binding.toolbarTitle.setText(
getString(R.string.editIssueNavHeader, String.valueOf(issue.getIssueIndex())));
}
@ -135,12 +124,55 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
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() {
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
String editIssueTitleForm = editIssueTitle.getText().toString();
String editIssueDescriptionForm = editIssueDescription.getText().toString();
String editIssueTitleForm =
Objects.requireNonNull(binding.editIssueTitle.getText()).toString();
String editIssueDescriptionForm =
Objects.requireNonNull(binding.editIssueDescription.getText()).toString();
if (!connToInternet) {
@ -230,7 +262,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
@Override
public void onClick(View v) {
if (v == editIssueDueDate) {
if (v == binding.editIssueDueDate) {
final Calendar c = Calendar.getInstance();
int mYear = c.get(Calendar.YEAR);
@ -241,7 +273,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
new DatePickerDialog(
this,
(view, year, monthOfYear, dayOfMonth) -> {
editIssueDueDate.setText(
binding.editIssueDueDate.setText(
getString(
R.string.setDueDate,
year,
@ -253,7 +285,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
mMonth,
mDay);
datePickerDialog.show();
} else if (v == editIssueButton) {
} else if (v == binding.editIssueButton) {
processEditIssue();
}
@ -277,8 +309,8 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
if (response.code() == 200) {
assert response.body() != null;
editIssueTitle.setText(response.body().getTitle());
editIssueDescription.setText(response.body().getBody());
binding.editIssueTitle.setText(response.body().getTitle());
binding.editIssueDescription.setText(response.body().getBody());
Milestone currentMilestone = response.body().getMilestone();
@ -343,9 +375,10 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
milestonesList
.keySet()));
editIssueMilestoneSpinner.setAdapter(adapter);
binding.editIssueMilestoneSpinner.setAdapter(
adapter);
editIssueMilestoneSpinner
binding.editIssueMilestoneSpinner
.setOnItemClickListener(
(parent,
view,
@ -379,14 +412,16 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
Math.toIntExact(
currentMilestone
.getId());
editIssueMilestoneSpinner
binding
.editIssueMilestoneSpinner
.setText(
currentMilestone
.getTitle(),
false);
} else {
milestoneId = 0;
editIssueMilestoneSpinner
binding
.editIssueMilestoneSpinner
.setText(
getString(
R
@ -417,7 +452,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
@SuppressLint("SimpleDateFormat")
DateFormat formatter = new SimpleDateFormat("yyyy-M-dd");
String dueDate = formatter.format(response.body().getDueDate());
editIssueDueDate.setText(dueDate);
binding.editIssueDueDate.setText(dueDate);
}
// enableProcessButton();
@ -440,12 +475,12 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
private void disableProcessButton() {
editIssueButton.setEnabled(false);
binding.editIssueButton.setEnabled(false);
}
private void enableProcessButton() {
editIssueButton.setEnabled(true);
binding.editIssueButton.setEnabled(true);
}
@Override

View File

@ -135,6 +135,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe
}
});
public ActivityResultLauncher<Intent> createIssueLauncher =
registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(), result -> {});
public ActivityResultLauncher<Intent> createPrLauncher =
registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(), result -> {});
@Override
public void onCreate(Bundle savedInstanceState) {

View File

@ -10,7 +10,6 @@ import android.widget.TimePicker;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mian.gitnex.R;
import org.mian.gitnex.databinding.ActivitySettingsAppearanceBinding;
import org.mian.gitnex.fragments.SettingsFragment;
@ -47,8 +46,6 @@ public class SettingsAppearanceActivity extends BaseActivity {
activitySettingsAppearanceBinding.lightThemeTimeSelectionFrame;
LinearLayout darkTimeFrame = activitySettingsAppearanceBinding.darkThemeTimeSelectionFrame;
SwitchMaterial counterBadgesSwitch = activitySettingsAppearanceBinding.switchCounterBadge;
customFontList = getResources().getStringArray(R.array.fonts);
themeList = getResources().getStringArray(R.array.themes);
@ -94,16 +91,19 @@ public class SettingsAppearanceActivity extends BaseActivity {
lightTimeFrame.setVisibility(View.GONE);
}
counterBadgesSwitch.setChecked(tinyDB.getBoolean("enableCounterBadges", true));
activitySettingsAppearanceBinding.switchCounterBadge.setChecked(
tinyDB.getBoolean("enableCounterBadges", true));
// counter badge switcher
counterBadgesSwitch.setOnCheckedChangeListener(
activitySettingsAppearanceBinding.switchCounterBadge.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
tinyDB.putBoolean("enableCounterBadges", isChecked);
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
});
activitySettingsAppearanceBinding.counterBadgeFrame.setOnClickListener(
v -> counterBadgesSwitch.setChecked(!counterBadgesSwitch.isChecked()));
v ->
activitySettingsAppearanceBinding.switchCounterBadge.setChecked(
!activitySettingsAppearanceBinding.switchCounterBadge.isChecked()));
// show labels in lists(issues, pr) - default is color dots
activitySettingsAppearanceBinding.switchLabelsInListBadge.setChecked(

View File

@ -13,7 +13,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.biometric.BiometricManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
@ -63,8 +62,6 @@ public class SettingsSecurityActivity extends BaseActivity {
activitySettingsSecurityBinding.cacheSizeImagesSelectionFrame;
LinearLayout clearCacheFrame = activitySettingsSecurityBinding.clearCacheSelectionFrame;
SwitchMaterial switchBiometric = activitySettingsSecurityBinding.switchBiometric;
cacheSizeDataList = getResources().getStringArray(R.array.cacheSizeList);
cacheSizeImagesList = getResources().getStringArray(R.array.cacheSizeList);
@ -86,10 +83,11 @@ public class SettingsSecurityActivity extends BaseActivity {
cacheSizeImagesSelectedChoice = tinyDB.getInt("cacheSizeImagesId");
}
switchBiometric.setChecked(tinyDB.getBoolean("biometricStatus", false));
activitySettingsSecurityBinding.switchBiometric.setChecked(
tinyDB.getBoolean("biometricStatus", false));
// biometric switcher
switchBiometric.setOnCheckedChangeListener(
activitySettingsSecurityBinding.switchBiometric.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
if (isChecked) {
@ -112,7 +110,8 @@ public class SettingsSecurityActivity extends BaseActivity {
case BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED:
case BiometricManager.BIOMETRIC_STATUS_UNKNOWN:
tinyDB.putBoolean("biometricStatus", false);
switchBiometric.setChecked(false);
activitySettingsSecurityBinding.switchBiometric.setChecked(
false);
Toasty.error(
appCtx,
getResources()
@ -120,7 +119,8 @@ public class SettingsSecurityActivity extends BaseActivity {
break;
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
tinyDB.putBoolean("biometricStatus", false);
switchBiometric.setChecked(false);
activitySettingsSecurityBinding.switchBiometric.setChecked(
false);
Toasty.error(
appCtx,
getResources()
@ -128,7 +128,8 @@ public class SettingsSecurityActivity extends BaseActivity {
break;
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
tinyDB.putBoolean("biometricStatus", false);
switchBiometric.setChecked(false);
activitySettingsSecurityBinding.switchBiometric.setChecked(
false);
Toasty.info(
appCtx,
getResources().getString(R.string.enrollBiometric));
@ -147,7 +148,9 @@ public class SettingsSecurityActivity extends BaseActivity {
});
activitySettingsSecurityBinding.biometricFrame.setOnClickListener(
v -> switchBiometric.setChecked(!switchBiometric.isChecked()));
v ->
activitySettingsSecurityBinding.switchBiometric.setChecked(
!activitySettingsSecurityBinding.switchBiometric.isChecked()));
// clear cache setter
File cacheDir = appCtx.getCacheDir();

View File

@ -11,6 +11,9 @@ import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import org.mian.gitnex.actions.RepositoryActions;
import org.mian.gitnex.activities.BaseActivity;
import org.mian.gitnex.activities.CreateIssueActivity;
import org.mian.gitnex.activities.CreatePullRequestActivity;
import org.mian.gitnex.activities.RepoDetailActivity;
import org.mian.gitnex.databinding.BottomSheetRepoBinding;
import org.mian.gitnex.helpers.contexts.AccountContext;
import org.mian.gitnex.helpers.contexts.RepositoryContext;
@ -37,6 +40,8 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
BottomSheetRepoBinding bottomSheetRepoBinding =
BottomSheetRepoBinding.inflate(inflater, container, false);
final Context ctx = getContext();
AccountContext account = ((BaseActivity) requireActivity()).getAccount();
TextView createLabel = bottomSheetRepoBinding.createLabel;
@ -90,7 +95,9 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
createIssue.setVisibility(View.VISIBLE);
createIssue.setOnClickListener(
v12 -> {
bmListener.onButtonClicked("newIssue");
((RepoDetailActivity) requireActivity())
.createIssueLauncher.launch(
repository.getIntent(ctx, CreateIssueActivity.class));
dismiss();
});
} else {
@ -102,8 +109,10 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
createPullRequest.setVisibility(View.VISIBLE);
createPullRequest.setOnClickListener(
vPr -> {
bmListener.onButtonClicked("newPullRequest");
v12 -> {
((RepoDetailActivity) requireActivity())
.createPrLauncher.launch(
repository.getIntent(ctx, CreatePullRequestActivity.class));
dismiss();
});
} else {

View File

@ -42,7 +42,7 @@ public class UrlHelper {
public static String appendPath(String url, String path) {
if (url.endsWith("/")) {
// remove it
url = url.substring(0, url.length() - 1);
url = url.substring(0, url.length() - 8);
}
if (!path.startsWith("/")) {
// add it

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp">
<shape android:shape="oval">
<size
android:width="20dp"
android:height="20dp"/>
</shape>
</item>
</layer-list>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="56dp"/>
<size
android:width="64dp"
android:height="28dp"/>
</shape>
</item>
</layer-list>

View File

@ -30,7 +30,7 @@
android:contentDescription="@string/close"
android:focusable="true"
android:gravity="center_vertical"
android:src="@drawable/ic_close"/>
android:src="@drawable/ic_close" />
<TextView
android:id="@+id/toolbar_title"
@ -40,7 +40,7 @@
android:maxLines="1"
android:text="@string/pageTitleCreateNewIssue"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen20sp"/>
android:textSize="@dimen/dimen20sp" />
</com.google.android.material.appbar.MaterialToolbar>
@ -93,7 +93,7 @@
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</com.google.android.material.textfield.TextInputLayout>
@ -114,17 +114,29 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/newIssueDescription"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp"
android:layout_height="@dimen/dimen180dp"
android:gravity="top|start"
android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/markdown_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dimen186dp"
android:layout_marginTop="@dimen/dimen8dp"
android:layout_marginBottom="@dimen/dimen8dp"
android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true"
android:textSize="@dimen/dimen14sp"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/newIssueAssigneesListLayout"
android:layout_width="match_parent"
@ -144,7 +156,7 @@
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</com.google.android.material.textfield.TextInputLayout>
@ -168,7 +180,7 @@
android:inputType="none"
android:labelFor="@+id/newIssueMilestoneSpinner"
android:textColor="?attr/inputTextColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</com.google.android.material.textfield.TextInputLayout>
@ -191,7 +203,7 @@
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</com.google.android.material.textfield.TextInputLayout>
@ -218,7 +230,7 @@
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
android:textColorHint="?attr/hintColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</com.google.android.material.textfield.TextInputLayout>
@ -229,7 +241,7 @@
android:layout_marginTop="@dimen/dimen8dp"
android:text="@string/newCreateButtonCopy"
android:textColor="@color/btnTextColor"
android:textStyle="bold"/>
android:textStyle="bold" />
</LinearLayout>

View File

@ -105,7 +105,7 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/milestoneDescription"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp"
android:layout_height="@dimen/dimen180dp"
android:gravity="top|start"
android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical"
@ -116,6 +116,18 @@
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/markdown_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dimen206dp"
android:layout_marginTop="@dimen/dimen8dp"
android:layout_marginBottom="@dimen/dimen8dp"
android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true"
android:textSize="@dimen/dimen14sp"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/milestoneDueDateLayout"
android:layout_width="match_parent"

View File

@ -114,7 +114,7 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/prBody"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp"
android:layout_height="@dimen/dimen180dp"
android:gravity="top|start"
android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical"
@ -125,6 +125,18 @@
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/markdown_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dimen186dp"
android:layout_marginTop="@dimen/dimen8dp"
android:layout_marginBottom="@dimen/dimen8dp"
android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true"
android:textSize="@dimen/dimen14sp"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/mergeIntoBranchSpinnerLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"

View File

@ -130,9 +130,9 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/releaseContent"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp"
android:layout_height="@dimen/dimen180dp"
android:gravity="top|start"
android:inputType="textCapSentences"
android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical"
android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor"
@ -141,6 +141,18 @@
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/markdown_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dimen186dp"
android:layout_marginTop="@dimen/dimen8dp"
android:layout_marginBottom="@dimen/dimen8dp"
android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true"
android:textSize="@dimen/dimen14sp"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/releaseBranchLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"

View File

@ -113,6 +113,18 @@
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/markdown_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/dimen186dp"
android:layout_marginTop="@dimen/dimen8dp"
android:layout_marginBottom="@dimen/dimen8dp"
android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true"
android:textSize="@dimen/dimen14sp"
android:visibility="gone" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/editIssueMilestoneSpinnerLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"

View File

@ -199,7 +199,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchCounterBadge"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp"
@ -208,8 +208,7 @@
android:layout_toEndOf="@+id/tvCounterBadgeHeader"
android:gravity="end"
android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</RelativeLayout>
@ -246,13 +245,12 @@
android:gravity="center_vertical|end"
android:orientation="horizontal">
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchLabelsInListBadge"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen32dp"
android:paddingStart="@dimen/dimen24dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp" />
android:paddingEnd="@dimen/dimen24dp" />
</LinearLayout>

View File

@ -32,7 +32,7 @@
android:contentDescription="@string/close"
android:focusable="true"
android:gravity="center_vertical"
android:src="@drawable/ic_close"/>
android:src="@drawable/ic_close" />
<TextView
android:id="@+id/toolbarTitle"
@ -42,7 +42,7 @@
android:maxLines="1"
android:text="@string/draftsHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen20sp"/>
android:textSize="@dimen/dimen20sp" />
</com.google.android.material.appbar.MaterialToolbar>
@ -71,7 +71,7 @@
android:layout_marginStart="@dimen/dimen24dp"
android:text="@string/settingsEnableCommentsDeletionText"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<LinearLayout
android:layout_width="wrap_content"
@ -80,13 +80,12 @@
android:gravity="center_vertical|end"
android:orientation="horizontal">
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/commentsDeletionSwitch"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen32dp"
android:paddingStart="@dimen/dimen24dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</LinearLayout>
@ -100,7 +99,7 @@
android:layout_marginEnd="@dimen/dimen72dp"
android:text="@string/settingsEnableCommentsDeletionHintText"
android:textColor="?attr/hintColor"
android:textSize="@dimen/dimen12sp"/>
android:textSize="@dimen/dimen12sp" />
</RelativeLayout>

View File

@ -142,7 +142,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchTabs"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp"
@ -151,8 +151,7 @@
android:layout_toEndOf="@+id/customTabsHeader"
android:gravity="end"
android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</RelativeLayout>

View File

@ -34,7 +34,7 @@
android:contentDescription="@string/close"
android:focusable="true"
android:gravity="center_vertical"
android:src="@drawable/ic_close"/>
android:src="@drawable/ic_close" />
<TextView
android:id="@+id/toolbar_title"
@ -44,7 +44,7 @@
android:maxLines="1"
android:text="@string/pageTitleNotifications"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen20sp"/>
android:textSize="@dimen/dimen20sp" />
</androidx.appcompat.widget.Toolbar>
@ -68,7 +68,7 @@
android:layout_marginStart="@dimen/dimen24dp"
android:text="@string/enableNotificationsHeaderText"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<LinearLayout
android:layout_width="wrap_content"
@ -77,13 +77,12 @@
android:gravity="center_vertical|end"
android:orientation="horizontal">
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/enableNotificationsMode"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen32dp"
android:paddingStart="@dimen/dimen24dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</LinearLayout>
@ -106,7 +105,7 @@
android:layout_marginEnd="@dimen/dimen24dp"
android:text="@string/notificationsPollingHeaderText"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<TextView
android:id="@+id/pollingDelaySelected"
@ -116,7 +115,7 @@
android:layout_marginEnd="@dimen/dimen24dp"
android:text="@string/pollingDelaySelectedText"
android:textColor="?attr/selectedTextColor"
android:textSize="@dimen/dimen16sp"/>
android:textSize="@dimen/dimen16sp" />
</LinearLayout>
@ -137,9 +136,9 @@
android:layout_marginEnd="@dimen/dimen24dp"
android:text="@string/enableLightsHeaderText"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/enableLightsMode"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp"
@ -148,8 +147,7 @@
android:layout_toEndOf="@+id/enableLightsHeader"
android:gravity="end"
android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</RelativeLayout>
@ -170,7 +168,7 @@
android:layout_marginEnd="@dimen/dimen24dp"
android:text="@string/chooseColorSelectorHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/chooseColorState"
@ -182,7 +180,7 @@
android:layout_marginEnd="@dimen/dimen28dp"
android:gravity="end"
app:cardCornerRadius="@dimen/dimen16dp"
app:cardElevation="@dimen/dimen0dp"/>
app:cardElevation="@dimen/dimen0dp" />
</RelativeLayout>
@ -203,9 +201,9 @@
android:layout_marginEnd="@dimen/dimen72dp"
android:text="@string/enableVibrationHeaderText"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/enableVibrationMode"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp"
@ -214,8 +212,7 @@
android:layout_toEndOf="@+id/enableVibrationHeader"
android:gravity="end"
android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</RelativeLayout>

View File

@ -31,7 +31,7 @@
android:contentDescription="@string/close"
android:focusable="true"
android:gravity="center_vertical"
android:src="@drawable/ic_close"/>
android:src="@drawable/ic_close" />
<TextView
android:id="@+id/toolbar_title"
@ -41,7 +41,7 @@
android:maxLines="1"
android:text="@string/reportViewerHeader"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen20sp"/>
android:textSize="@dimen/dimen20sp" />
</com.google.android.material.appbar.MaterialToolbar>
@ -65,7 +65,7 @@
android:layout_marginStart="@dimen/dimen24dp"
android:text="@string/settingsEnableReportsText"
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
android:textSize="@dimen/dimen18sp" />
<LinearLayout
android:layout_width="wrap_content"
@ -74,13 +74,12 @@
android:gravity="center_vertical|end"
android:orientation="horizontal">
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/crashReportsSwitch"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen32dp"
android:paddingStart="@dimen/dimen24dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</LinearLayout>

View File

@ -66,7 +66,7 @@
android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen18sp"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchBiometric"
android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp"
@ -75,8 +75,7 @@
android:layout_toEndOf="@+id/biometricHeader"
android:gravity="end"
android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp"
android:switchMinWidth="@dimen/dimen56dp"/>
android:paddingEnd="@dimen/dimen24dp" />
</RelativeLayout>

View File

@ -79,7 +79,7 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:padding="4dp"
android:text="@string/label"
android:text="@string/labelTxt"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
app:drawableTopCompat="@drawable/ic_tag"

View File

@ -79,7 +79,7 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:padding="4dp"
android:text="@string/label"
android:text="@string/labelTxt"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp"
app:drawableTopCompat="@drawable/ic_tag"

View File

@ -99,7 +99,7 @@
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoPrivate"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -107,7 +107,7 @@
android:text="@string/newRepoPrivateCopy"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoAsTemplate"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -115,7 +115,7 @@
android:text="@string/repoPropertiesTemplate"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableIssues"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -123,7 +123,7 @@
android:text="@string/repoPropertiesEnableIssues"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableWiki"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -131,7 +131,7 @@
android:text="@string/repoPropertiesEnableWiki"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnablePr"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -139,7 +139,7 @@
android:text="@string/repoPropertiesEnablePr"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableTimer"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -147,7 +147,7 @@
android:text="@string/repoPropertiesEnableTimeTracker"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableMerge"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -155,7 +155,7 @@
android:text="@string/repoPropertiesEnableMergeCommits"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableRebase"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -163,7 +163,7 @@
android:text="@string/repoPropertiesEnableRebase"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableSquash"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -171,7 +171,7 @@
android:text="@string/repoPropertiesEnableSquash"
android:textColor="?attr/primaryTextColor"/>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/repoEnableForceMerge"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -42,7 +42,6 @@
<item name="colorSurface">@color/lightThemeInputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">0</item>
</style>
<!-- Light theme -->
@ -88,7 +87,6 @@
<item name="colorSurface">@color/retroThemeInputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">0</item>
</style>
<!-- Retro theme -->

View File

@ -34,7 +34,9 @@
<dimen name="dimen140dp">140dp</dimen>
<dimen name="dimen150dp">150dp</dimen>
<dimen name="dimen180dp">180dp</dimen>
<dimen name="dimen186dp">186dp</dimen>
<dimen name="dimen200dp">200dp</dimen>
<dimen name="dimen206dp">206dp</dimen>
<dimen name="dimen320dp">320dp</dimen>
<dimen name="dimen480dp">480dp</dimen>

View File

@ -42,7 +42,6 @@
<item name="colorSurface">@color/inputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">1</item>
</style>
<!-- Dark theme - default -->
@ -88,7 +87,6 @@
<item name="colorSurface">@color/lightThemeInputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">0</item>
</style>
<!-- Light theme -->
@ -133,7 +131,6 @@
<item name="colorSurface">@color/retroThemeInputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">0</item>
</style>
<!-- Retro theme -->
@ -179,7 +176,6 @@
<item name="colorSurface">@color/inputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">1</item>
</style>
<!-- Pitch black theme -->
@ -205,14 +201,6 @@
<item name="cornerFamily">rounded</item>
</style>
<!-- Material switch style -->
<style name="MaterialSwitch" parent="Widget.MaterialComponents.CompoundButton.Switch">
<item name="switchMinWidth">@dimen/dimen32dp</item>
<item name="minHeight">@dimen/dimen24dp</item>
<item name="track">@drawable/switch_track</item>
<item name="android:thumb">@drawable/switch_thumb</item>
</style>
<style name="inputsMaterialComponentCorner" parent="ShapeAppearance.Material3.SmallComponent">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">@dimen/dimen6dp</item>

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.3.0'
}
}