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

View File

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

View File

@ -5,6 +5,9 @@ import android.app.DatePickerDialog;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
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.view.inputmethod.InputMethodManager;
@ -12,6 +15,7 @@ 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.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.vdurmont.emoji.EmojiParser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; 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.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil; 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.Toasty; import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.helpers.contexts.RepositoryContext; import org.mian.gitnex.helpers.contexts.RepositoryContext;
import retrofit2.Call; import retrofit2.Call;
@ -62,6 +67,8 @@ public class CreateIssueActivity extends BaseActivity
private MaterialAlertDialogBuilder materialAlertDialogBuilder; private MaterialAlertDialogBuilder materialAlertDialogBuilder;
private List<Integer> labelsIds = new ArrayList<>(); private List<Integer> labelsIds = new ArrayList<>();
private List<String> assigneesListData = new ArrayList<>(); private List<String> assigneesListData = new ArrayList<>();
private boolean renderMd = false;
private RepositoryContext repositoryContext;
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
@Override @Override
@ -71,6 +78,9 @@ public class CreateIssueActivity extends BaseActivity
viewBinding = ActivityCreateIssueBinding.inflate(getLayoutInflater()); viewBinding = ActivityCreateIssueBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot()); setContentView(viewBinding.getRoot());
setSupportActionBar(viewBinding.toolbar);
repositoryContext = RepositoryContext.fromIntent(getIntent());
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx); 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 @Override
public void assigneesInterface(List<String> data) { public void assigneesInterface(List<String> data) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ public class UrlHelper {
public static String appendPath(String url, String path) { public static String appendPath(String url, String path) {
if (url.endsWith("/")) { if (url.endsWith("/")) {
// remove it // remove it
url = url.substring(0, url.length() - 1); url = url.substring(0, url.length() - 8);
} }
if (!path.startsWith("/")) { if (!path.startsWith("/")) {
// add it // 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:contentDescription="@string/close"
android:focusable="true" android:focusable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:src="@drawable/ic_close"/> android:src="@drawable/ic_close" />
<TextView <TextView
android:id="@+id/toolbar_title" android:id="@+id/toolbar_title"
@ -40,7 +40,7 @@
android:maxLines="1" android:maxLines="1"
android:text="@string/pageTitleCreateNewIssue" android:text="@string/pageTitleCreateNewIssue"
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:textSize="@dimen/dimen20sp"/> android:textSize="@dimen/dimen20sp" />
</com.google.android.material.appbar.MaterialToolbar> </com.google.android.material.appbar.MaterialToolbar>
@ -93,7 +93,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>
@ -114,17 +114,29 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/newIssueDescription" android:id="@+id/newIssueDescription"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp" android:layout_height="@dimen/dimen180dp"
android:gravity="top|start" android:gravity="top|start"
android:inputType="textCapSentences|textMultiLine" android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical" android:scrollbars="vertical"
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>
<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 <com.google.android.material.textfield.TextInputLayout
android:id="@+id/newIssueAssigneesListLayout" android:id="@+id/newIssueAssigneesListLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -144,7 +156,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>
@ -168,7 +180,7 @@
android:inputType="none" android:inputType="none"
android:labelFor="@+id/newIssueMilestoneSpinner" android:labelFor="@+id/newIssueMilestoneSpinner"
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>
@ -191,7 +203,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>
@ -218,7 +230,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>
@ -229,7 +241,7 @@
android:layout_marginTop="@dimen/dimen8dp" android:layout_marginTop="@dimen/dimen8dp"
android:text="@string/newCreateButtonCopy" android:text="@string/newCreateButtonCopy"
android:textColor="@color/btnTextColor" android:textColor="@color/btnTextColor"
android:textStyle="bold"/> android:textStyle="bold" />
</LinearLayout> </LinearLayout>

View File

@ -105,7 +105,7 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/milestoneDescription" android:id="@+id/milestoneDescription"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp" android:layout_height="@dimen/dimen180dp"
android:gravity="top|start" android:gravity="top|start"
android:inputType="textCapSentences|textMultiLine" android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical" android:scrollbars="vertical"
@ -116,6 +116,18 @@
</com.google.android.material.textfield.TextInputLayout> </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 <com.google.android.material.textfield.TextInputLayout
android:id="@+id/milestoneDueDateLayout" android:id="@+id/milestoneDueDateLayout"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -114,7 +114,7 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/prBody" android:id="@+id/prBody"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp" android:layout_height="@dimen/dimen180dp"
android:gravity="top|start" android:gravity="top|start"
android:inputType="textCapSentences|textMultiLine" android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical" android:scrollbars="vertical"
@ -125,6 +125,18 @@
</com.google.android.material.textfield.TextInputLayout> </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 <com.google.android.material.textfield.TextInputLayout
android:id="@+id/mergeIntoBranchSpinnerLayout" android:id="@+id/mergeIntoBranchSpinnerLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu" style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"

View File

@ -130,9 +130,9 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/releaseContent" android:id="@+id/releaseContent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dimen140dp" android:layout_height="@dimen/dimen180dp"
android:gravity="top|start" android:gravity="top|start"
android:inputType="textCapSentences" android:inputType="textCapSentences|textMultiLine"
android:scrollbars="vertical" android:scrollbars="vertical"
android:textColor="?attr/inputTextColor" android:textColor="?attr/inputTextColor"
android:textColorHighlight="?attr/hintColor" android:textColorHighlight="?attr/hintColor"
@ -141,6 +141,18 @@
</com.google.android.material.textfield.TextInputLayout> </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 <com.google.android.material.textfield.TextInputLayout
android:id="@+id/releaseBranchLayout" android:id="@+id/releaseBranchLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu" style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"

View File

@ -113,6 +113,18 @@
</com.google.android.material.textfield.TextInputLayout> </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 <com.google.android.material.textfield.TextInputLayout
android:id="@+id/editIssueMilestoneSpinnerLayout" android:id="@+id/editIssueMilestoneSpinnerLayout"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu" style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"

View File

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

View File

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

View File

@ -142,7 +142,7 @@
android:textColor="?attr/primaryTextColor" 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/switchTabs" android:id="@+id/switchTabs"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp" android:layout_height="@dimen/dimen24dp"
@ -151,8 +151,7 @@
android:layout_toEndOf="@+id/customTabsHeader" android:layout_toEndOf="@+id/customTabsHeader"
android:gravity="end" android:gravity="end"
android:paddingStart="@dimen/dimen0dp" android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp" android:paddingEnd="@dimen/dimen24dp" />
android:switchMinWidth="@dimen/dimen56dp"/>
</RelativeLayout> </RelativeLayout>

View File

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

View File

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

View File

@ -66,7 +66,7 @@
android:textColor="?attr/primaryTextColor" 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/switchBiometric" android:id="@+id/switchBiometric"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dimen24dp" android:layout_height="@dimen/dimen24dp"
@ -75,8 +75,7 @@
android:layout_toEndOf="@+id/biometricHeader" android:layout_toEndOf="@+id/biometricHeader"
android:gravity="end" android:gravity="end"
android:paddingStart="@dimen/dimen0dp" android:paddingStart="@dimen/dimen0dp"
android:paddingEnd="@dimen/dimen24dp" android:paddingEnd="@dimen/dimen24dp" />
android:switchMinWidth="@dimen/dimen56dp"/>
</RelativeLayout> </RelativeLayout>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,6 @@
<item name="colorSurface">@color/inputBackground</item> <item name="colorSurface">@color/inputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item> <item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item> <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">1</item> <item name="isDark">1</item>
</style> </style>
<!-- Dark theme - default --> <!-- Dark theme - default -->
@ -88,7 +87,6 @@
<item name="colorSurface">@color/lightThemeInputBackground</item> <item name="colorSurface">@color/lightThemeInputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item> <item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item> <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">0</item> <item name="isDark">0</item>
</style> </style>
<!-- Light theme --> <!-- Light theme -->
@ -133,7 +131,6 @@
<item name="colorSurface">@color/retroThemeInputBackground</item> <item name="colorSurface">@color/retroThemeInputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item> <item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item> <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">0</item> <item name="isDark">0</item>
</style> </style>
<!-- Retro theme --> <!-- Retro theme -->
@ -179,7 +176,6 @@
<item name="colorSurface">@color/inputBackground</item> <item name="colorSurface">@color/inputBackground</item>
<item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item> <item name="shapeAppearanceSmallComponent">@style/inputsMaterialComponentCorner</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item> <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="switchStyle">@style/MaterialSwitch</item>
<item name="isDark">1</item> <item name="isDark">1</item>
</style> </style>
<!-- Pitch black theme --> <!-- Pitch black theme -->
@ -205,14 +201,6 @@
<item name="cornerFamily">rounded</item> <item name="cornerFamily">rounded</item>
</style> </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"> <style name="inputsMaterialComponentCorner" parent="ShapeAppearance.Material3.SmallComponent">
<item name="cornerFamily">rounded</item> <item name="cornerFamily">rounded</item>
<item name="cornerSize">@dimen/dimen6dp</item> <item name="cornerSize">@dimen/dimen6dp</item>

View File

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