Skip to content

Commit

Permalink
feat(mian):use markwon to show markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCShou committed Nov 5, 2022
1 parent 0fc56dc commit 8d3b9f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ dependencies {
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.elvishew:xlog:1.11.0'
implementation 'io.noties.markwon:core:4.6.2'
implementation files('libs/BaiduLBS_Android.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/com/zcshou/gogogo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@

import com.elvishew.xlog.XLog;

import io.noties.markwon.Markwon;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
Expand Down Expand Up @@ -1428,10 +1429,8 @@ public void onResponse(@NonNull Call call, @NonNull okhttp3.Response response) t
updateCommit.setText(getRetJson.getString("target_commitish"));

TextView updateContent = window.findViewById(R.id.update_content);
SpannableStringBuilder ssb = new SpannableStringBuilder();
ssb.append(getRetJson.getString("body"));
updateContent.setMovementMethod(LinkMovementMethod.getInstance());
updateContent.setText(ssb, TextView.BufferType.SPANNABLE);
final Markwon markwon = Markwon.create(MainActivity.this);
markwon.setMarkdown(updateContent, getRetJson.getString("body"));

Button updateCancel = window.findViewById(R.id.update_ignore);
updateCancel.setOnClickListener(v -> alertDialog.cancel());
Expand Down

0 comments on commit 8d3b9f5

Please sign in to comment.