mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
Use full md renderer for create issue/pr. Fix assets path (possible fix)
This commit is contained in:
parent
532f79cf53
commit
e7f692835f
|
@ -68,6 +68,7 @@ public class CreateIssueActivity extends BaseActivity
|
|||
private List<Integer> labelsIds = new ArrayList<>();
|
||||
private List<String> assigneesListData = new ArrayList<>();
|
||||
private boolean renderMd = false;
|
||||
private RepositoryContext repositoryContext;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
|
@ -79,6 +80,8 @@ public class CreateIssueActivity extends BaseActivity
|
|||
setContentView(viewBinding.getRoot());
|
||||
setSupportActionBar(viewBinding.toolbar);
|
||||
|
||||
repositoryContext = RepositoryContext.fromIntent(getIntent());
|
||||
|
||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
||||
|
||||
InputMethodManager imm =
|
||||
|
@ -164,11 +167,10 @@ public class CreateIssueActivity extends BaseActivity
|
|||
Markdown.render(
|
||||
ctx,
|
||||
EmojiParser.parseToUnicode(
|
||||
Objects.requireNonNull(
|
||||
Objects.requireNonNull(
|
||||
viewBinding.newIssueDescription.getText())
|
||||
.toString())),
|
||||
viewBinding.markdownPreview);
|
||||
Objects.requireNonNull(viewBinding.newIssueDescription.getText())
|
||||
.toString()),
|
||||
viewBinding.markdownPreview,
|
||||
repositoryContext);
|
||||
|
||||
viewBinding.markdownPreview.setVisibility(View.VISIBLE);
|
||||
viewBinding.newIssueDescriptionLayout.setVisibility(View.GONE);
|
||||
|
|
|
@ -59,6 +59,7 @@ public class CreatePullRequestActivity extends BaseActivity
|
|||
private LabelsListAdapter labelsAdapter;
|
||||
private MaterialAlertDialogBuilder materialAlertDialogBuilder;
|
||||
private boolean renderMd = false;
|
||||
private RepositoryContext repositoryContext;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
|
@ -70,6 +71,8 @@ public class CreatePullRequestActivity extends BaseActivity
|
|||
setContentView(viewBinding.getRoot());
|
||||
setSupportActionBar(viewBinding.toolbar);
|
||||
|
||||
repositoryContext = RepositoryContext.fromIntent(getIntent());
|
||||
|
||||
materialAlertDialogBuilder =
|
||||
new MaterialAlertDialogBuilder(ctx, R.style.ThemeOverlay_Material3_Dialog_Alert);
|
||||
|
||||
|
@ -135,10 +138,9 @@ public class CreatePullRequestActivity extends BaseActivity
|
|||
Markdown.render(
|
||||
ctx,
|
||||
EmojiParser.parseToUnicode(
|
||||
Objects.requireNonNull(
|
||||
Objects.requireNonNull(viewBinding.prBody.getText())
|
||||
.toString())),
|
||||
viewBinding.markdownPreview);
|
||||
Objects.requireNonNull(viewBinding.prBody.getText()).toString()),
|
||||
viewBinding.markdownPreview,
|
||||
repositoryContext);
|
||||
|
||||
viewBinding.markdownPreview.setVisibility(View.VISIBLE);
|
||||
viewBinding.prBodyLayout.setVisibility(View.GONE);
|
||||
|
|
|
@ -135,6 +135,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetListe
|
|||
}
|
||||
});
|
||||
|
||||
public ActivityResultLauncher<Intent> createIssueLauncher =
|
||||
registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(), result -> {});
|
||||
|
||||
public ActivityResultLauncher<Intent> createPrLauncher =
|
||||
registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(), result -> {});
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/markdown_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/markdown_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue