From a2d903cfde6c260739f8dc945d07e4234f8e4d23 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Thu, 19 Jan 2023 11:55:19 +0000 Subject: [PATCH] Preview of MD for supported inputs (#1213) Closes #487 Co-authored-by: M M Arif Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1213 Reviewed-by: qwerty287 --- app/build.gradle | 13 +- app/src/main/AndroidManifest.xml | 3 +- .../activities/CreateIssueActivity.java | 50 ++++++++ .../activities/CreateMilestoneActivity.java | 96 +++++++++----- .../activities/CreatePullRequestActivity.java | 49 +++++++ .../activities/CreateReleaseActivity.java | 120 ++++++++++------- .../gitnex/activities/EditIssueActivity.java | 121 +++++++++++------- .../gitnex/activities/RepoDetailActivity.java | 8 ++ .../SettingsAppearanceActivity.java | 12 +- .../activities/SettingsSecurityActivity.java | 21 +-- .../fragments/BottomSheetRepoFragment.java | 15 ++- .../org/mian/gitnex/helpers/UrlHelper.java | 2 +- app/src/main/res/drawable/switch_thumb.xml | 14 -- app/src/main/res/drawable/switch_track.xml | 11 -- .../main/res/layout/activity_create_issue.xml | 32 +++-- .../res/layout/activity_create_milestone.xml | 14 +- .../main/res/layout/activity_create_pr.xml | 14 +- .../res/layout/activity_create_release.xml | 16 ++- .../main/res/layout/activity_edit_issue.xml | 12 ++ .../layout/activity_settings_appearance.xml | 10 +- .../res/layout/activity_settings_drafts.xml | 13 +- .../res/layout/activity_settings_general.xml | 5 +- .../activity_settings_notifications.xml | 33 +++-- .../res/layout/activity_settings_reports.xml | 11 +- .../res/layout/activity_settings_security.xml | 5 +- .../res/layout/bottom_sheet_organization.xml | 2 +- app/src/main/res/layout/bottom_sheet_repo.xml | 2 +- ...stom_repository_edit_properties_dialog.xml | 20 +-- app/src/main/res/values-v23/themes.xml | 2 - app/src/main/res/values/dimens.xml | 2 + app/src/main/res/values/themes.xml | 12 -- build.gradle | 2 +- 32 files changed, 488 insertions(+), 254 deletions(-) delete mode 100644 app/src/main/res/drawable/switch_thumb.xml delete mode 100644 app/src/main/res/drawable/switch_track.xml diff --git a/app/build.gradle b/app/build.gradle index f654b62a..95eaa707 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index deb90e81..bfa94ba0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java index 31d07e44..95171c6b 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java @@ -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 labelsIds = new ArrayList<>(); private List 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 data) { diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java index f05117c8..ace22984 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateMilestoneActivity.java @@ -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 diff --git a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java index d5642df9..ed73c71a 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreatePullRequestActivity.java @@ -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()); diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java index 027abe58..ea863f48 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateReleaseActivity.java @@ -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 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 diff --git a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java index 19cde6bd..376504e7 100644 --- a/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/EditIssueActivity.java @@ -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 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 diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java index 599bd79a..8d64cc2e 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java @@ -135,6 +135,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe } }); + public ActivityResultLauncher createIssueLauncher = + registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), result -> {}); + + public ActivityResultLauncher createPrLauncher = + registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), result -> {}); + @Override public void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java index 14714352..9588302e 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java @@ -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( diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java index 8c23121f..0dfcc60a 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java @@ -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(); diff --git a/app/src/main/java/org/mian/gitnex/fragments/BottomSheetRepoFragment.java b/app/src/main/java/org/mian/gitnex/fragments/BottomSheetRepoFragment.java index 7b1d44b0..cdae012a 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/BottomSheetRepoFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/BottomSheetRepoFragment.java @@ -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 { diff --git a/app/src/main/java/org/mian/gitnex/helpers/UrlHelper.java b/app/src/main/java/org/mian/gitnex/helpers/UrlHelper.java index bfe73391..e1010f62 100644 --- a/app/src/main/java/org/mian/gitnex/helpers/UrlHelper.java +++ b/app/src/main/java/org/mian/gitnex/helpers/UrlHelper.java @@ -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 diff --git a/app/src/main/res/drawable/switch_thumb.xml b/app/src/main/res/drawable/switch_thumb.xml deleted file mode 100644 index 8aa76131..00000000 --- a/app/src/main/res/drawable/switch_thumb.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/drawable/switch_track.xml b/app/src/main/res/drawable/switch_track.xml deleted file mode 100644 index 22039153..00000000 --- a/app/src/main/res/drawable/switch_track.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/layout/activity_create_issue.xml b/app/src/main/res/layout/activity_create_issue.xml index 25716ce1..dd78459b 100644 --- a/app/src/main/res/layout/activity_create_issue.xml +++ b/app/src/main/res/layout/activity_create_issue.xml @@ -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" /> + android:textSize="@dimen/dimen20sp" /> @@ -93,7 +93,7 @@ android:textColor="?attr/inputTextColor" android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" - android:textSize="@dimen/dimen16sp"/> + android:textSize="@dimen/dimen16sp" /> @@ -114,17 +114,29 @@ + android:textSize="@dimen/dimen16sp" /> + + + android:textSize="@dimen/dimen16sp" /> @@ -168,7 +180,7 @@ android:inputType="none" android:labelFor="@+id/newIssueMilestoneSpinner" android:textColor="?attr/inputTextColor" - android:textSize="@dimen/dimen16sp"/> + android:textSize="@dimen/dimen16sp" /> @@ -191,7 +203,7 @@ android:textColor="?attr/inputTextColor" android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" - android:textSize="@dimen/dimen16sp"/> + android:textSize="@dimen/dimen16sp" /> @@ -218,7 +230,7 @@ android:textColor="?attr/inputTextColor" android:textColorHighlight="?attr/hintColor" android:textColorHint="?attr/hintColor" - android:textSize="@dimen/dimen16sp"/> + android:textSize="@dimen/dimen16sp" /> @@ -229,7 +241,7 @@ android:layout_marginTop="@dimen/dimen8dp" android:text="@string/newCreateButtonCopy" android:textColor="@color/btnTextColor" - android:textStyle="bold"/> + android:textStyle="bold" /> diff --git a/app/src/main/res/layout/activity_create_milestone.xml b/app/src/main/res/layout/activity_create_milestone.xml index e5350a02..80b48fa1 100644 --- a/app/src/main/res/layout/activity_create_milestone.xml +++ b/app/src/main/res/layout/activity_create_milestone.xml @@ -105,7 +105,7 @@ + + + + + + + + - + android:paddingEnd="@dimen/dimen24dp" /> @@ -246,13 +245,12 @@ android:gravity="center_vertical|end" android:orientation="horizontal"> - + android:paddingEnd="@dimen/dimen24dp" /> diff --git a/app/src/main/res/layout/activity_settings_drafts.xml b/app/src/main/res/layout/activity_settings_drafts.xml index 42a1dc8b..9ed3e627 100644 --- a/app/src/main/res/layout/activity_settings_drafts.xml +++ b/app/src/main/res/layout/activity_settings_drafts.xml @@ -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" /> + android:textSize="@dimen/dimen20sp" /> @@ -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" /> - + android:paddingEnd="@dimen/dimen24dp" /> @@ -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" /> diff --git a/app/src/main/res/layout/activity_settings_general.xml b/app/src/main/res/layout/activity_settings_general.xml index d11b3e5a..72284639 100644 --- a/app/src/main/res/layout/activity_settings_general.xml +++ b/app/src/main/res/layout/activity_settings_general.xml @@ -142,7 +142,7 @@ android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen18sp"/> - + android:paddingEnd="@dimen/dimen24dp" /> diff --git a/app/src/main/res/layout/activity_settings_notifications.xml b/app/src/main/res/layout/activity_settings_notifications.xml index a8a79d4e..66da9727 100644 --- a/app/src/main/res/layout/activity_settings_notifications.xml +++ b/app/src/main/res/layout/activity_settings_notifications.xml @@ -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" /> + android:textSize="@dimen/dimen20sp" /> @@ -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" /> - + android:paddingEnd="@dimen/dimen24dp" /> @@ -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" /> + android:textSize="@dimen/dimen16sp" /> @@ -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" /> - + android:paddingEnd="@dimen/dimen24dp" /> @@ -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" /> + app:cardElevation="@dimen/dimen0dp" /> @@ -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" /> - + android:paddingEnd="@dimen/dimen24dp" /> diff --git a/app/src/main/res/layout/activity_settings_reports.xml b/app/src/main/res/layout/activity_settings_reports.xml index 94e67a88..c9d1d384 100644 --- a/app/src/main/res/layout/activity_settings_reports.xml +++ b/app/src/main/res/layout/activity_settings_reports.xml @@ -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" /> + android:textSize="@dimen/dimen20sp" /> @@ -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" /> - + android:paddingEnd="@dimen/dimen24dp" /> diff --git a/app/src/main/res/layout/activity_settings_security.xml b/app/src/main/res/layout/activity_settings_security.xml index a0eb08b6..35967f02 100644 --- a/app/src/main/res/layout/activity_settings_security.xml +++ b/app/src/main/res/layout/activity_settings_security.xml @@ -66,7 +66,7 @@ android:textColor="?attr/primaryTextColor" android:textSize="@dimen/dimen18sp"/> - + android:paddingEnd="@dimen/dimen24dp" /> diff --git a/app/src/main/res/layout/bottom_sheet_organization.xml b/app/src/main/res/layout/bottom_sheet_organization.xml index d3bf335b..4627f382 100644 --- a/app/src/main/res/layout/bottom_sheet_organization.xml +++ b/app/src/main/res/layout/bottom_sheet_organization.xml @@ -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" diff --git a/app/src/main/res/layout/bottom_sheet_repo.xml b/app/src/main/res/layout/bottom_sheet_repo.xml index 387f565d..f2eba77e 100644 --- a/app/src/main/res/layout/bottom_sheet_repo.xml +++ b/app/src/main/res/layout/bottom_sheet_repo.xml @@ -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" diff --git a/app/src/main/res/layout/custom_repository_edit_properties_dialog.xml b/app/src/main/res/layout/custom_repository_edit_properties_dialog.xml index c7e04953..de923556 100644 --- a/app/src/main/res/layout/custom_repository_edit_properties_dialog.xml +++ b/app/src/main/res/layout/custom_repository_edit_properties_dialog.xml @@ -99,7 +99,7 @@ - - - - - - - - - - @color/lightThemeInputBackground @style/inputsMaterialComponentCorner @style/WindowAnimationTransition - @style/MaterialSwitch 0 @@ -88,7 +87,6 @@ @color/retroThemeInputBackground @style/inputsMaterialComponentCorner @style/WindowAnimationTransition - @style/MaterialSwitch 0 diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 67d29a65..2b445836 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -34,7 +34,9 @@ 140dp 150dp 180dp + 186dp 200dp + 206dp 320dp 480dp diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 0773cd79..7dfc55c8 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -42,7 +42,6 @@ @color/inputBackground @style/inputsMaterialComponentCorner @style/WindowAnimationTransition - @style/MaterialSwitch 1 @@ -88,7 +87,6 @@ @color/lightThemeInputBackground @style/inputsMaterialComponentCorner @style/WindowAnimationTransition - @style/MaterialSwitch 0 @@ -133,7 +131,6 @@ @color/retroThemeInputBackground @style/inputsMaterialComponentCorner @style/WindowAnimationTransition - @style/MaterialSwitch 0 @@ -179,7 +176,6 @@ @color/inputBackground @style/inputsMaterialComponentCorner @style/WindowAnimationTransition - @style/MaterialSwitch 1 @@ -205,14 +201,6 @@ rounded - - -