feat(mian):use markwon to show markdown

This commit is contained in:
ZCShou 2022-11-05 15:26:23 +08:00
parent 0fc56dc2b0
commit 8d3b9f5c07
No known key found for this signature in database
GPG Key ID: 40F856243C184EAB
2 changed files with 4 additions and 4 deletions

View File

@ -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'

View File

@ -106,6 +106,7 @@ import static android.view.View.GONE;
import com.elvishew.xlog.XLog;
import io.noties.markwon.Markwon;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
@ -1428,10 +1429,8 @@ public class MainActivity extends BaseActivity implements SensorEventListener {
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());