chore: migrate build and remove legacy SDK dependencies

This commit is contained in:
fengjignqi
2026-10-26 11:19:39 +08:00
parent cf9d1e22e1
commit 363db3357c
730 changed files with 8371 additions and 295 deletions

View File

@@ -4,8 +4,10 @@ apply plugin: 'com.hihonor.mcs.asplugin'
apply plugin: 'io.freefair.lombok' // ✅ 加上这个
android {
compileSdkVersion 33
lintOptions {
namespace 'com.kyzy.bazi'
compileSdk 36
lint {
checkReleaseBuilds false // 关闭 release 打包时 lint 检查
abortOnError false // 即使有错误也不终止编译
}
@@ -31,13 +33,10 @@ android {
}
buildFeatures {
dataBinding true
}
defaultConfig {
applicationId "com.kyzy.bazi"
minSdkVersion 26
targetSdkVersion 30
minSdk 26
targetSdk 36
versionCode 5
versionName "1.0.5"//version 1.0.0-appstore version 1.0.0-xh
// 添加自定义字段
@@ -60,7 +59,9 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
viewBinding true
buildConfig true
}
sourceSets {
@@ -78,7 +79,7 @@ android {
}
}
packagingOptions {
packaging {
exclude 'META-INF/filepicker_release.kotlin_module'
exclude 'lib/x86/libc++_shared.so'
exclude 'lib/armeabi-v7a/libc++_shared.so'
@@ -86,12 +87,6 @@ android {
exclude 'lib/x86_64/libc++_shared.so'
}
repositories {
flatDir {
dirs 'libs'
}
}
}
@@ -102,7 +97,7 @@ dependencies {
implementation 'com.google.android.material:material:1.6.0'
// testImplementation 'junit:junit:4.+'
// //(gson生成和解析库)
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.google.code.gson:gson:2.8.9'
api ('com.squareup.retrofit2:converter-gson:2.0.2'){
exclude group : 'com.google.code.gson'
}
@@ -116,8 +111,8 @@ dependencies {
api 'io.reactivex.rxjava2:rxandroid:2.0.1'
//okhttp的log信息 implementation 'com.squareup.okhttp3:okhttp:4.9.3' // 替换为最新版本
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'net.i2p.crypto:eddsa:0.3.0'
implementation "com.mapzen:on-the-road:1.2.0"
//fastJson
implementation files('libs\\fastjson-1.2.40.jar')
implementation project(path: ':imagepickerl')
@@ -126,9 +121,6 @@ dependencies {
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.1'
//banner
implementation 'io.github.youth5201314:banner:2.2.3'
implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
implementation("com.github.bumptech.glide:glide:4.12.0")
annotationProcessor ("com.github.bumptech.glide:compiler:4.12.0")
//BaseRecyclerViewAdapterHelper
@@ -145,88 +137,40 @@ dependencies {
// implementation 'com.amap.api:location:latest.integration'
//圆形视图库
implementation 'com.makeramen:roundedimageview:2.3.0'
//字母索引View,
implementation 'com.github.lzjin:SideBarView:1.0.1'
//拼音工具类
implementation 'com.belerweb:pinyin4j:2.5.0'
//地区三级联动插件
implementation 'com.contrarywind:Android-PickerView:4.1.9'
// implementation 'com.contrarywind:Android-Picker:4.1.0'
//富文本处理图片
implementation 'org.jsoup:jsoup:1.11.2'
//FlexboxLayoutManager 处理recycleview的不规整布局
implementation 'com.google.android:flexbox:2.0.1'
//吐司框架
implementation 'com.github.getActivity:Toaster:12.5'
//鲁班图片压缩
implementation 'top.zibin:Luban:1.1.8'
//带有侧滑功能的recyclerview
// implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
implementation 'com.github.luqiming666:SwipeRecyclerView:1.4.8'
//Activity与Fragmen实现沉浸式状态栏
implementation 'com.github.tangguna:immersion:1.0.1'
//viewpager2
implementation 'androidx.viewpager2:viewpager2:1.0.0'
//文件管理框架
implementation 'com.droidninja:filepicker:2.2.5'
// implementation 'com.github.angads25:filepicker:1.1.1'
// implementation 'io.github.tutorialsandroid:filepicker:9.2.5'
implementation 'me.rosuh:AndroidFilePicker:1.0.1'
implementation 'com.github.ns3chz:Picker:1.0.2'
implementation 'com.github.zzy0516alex:FileSelectorRelease:v6.2'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
//友盟相关
// 友盟基础组件库(所有友盟业务SDK都依赖基础组件库
// implementation 'com.umeng.umsdk:common:+'// 必选
// implementation 'com.umeng.umsdk:asms:+'// 必选
//
// implementation 'com.umeng.umsdk:uyumao:+' // 高级运营分析功能依赖库,使用U-App卸载分析、开启反作弊能力请务必集成。common需搭配v9.6.3及以上版本,asms需搭配v1.7.0及以上版本。需更新隐私声明。
//
// implementation 'com.umeng.umsdk:uverify:+'// 必选
// implementation 'com.umeng.umsdk:uverify-main:+'// 必选
// implementation 'com.umeng.umsdk:uverify-logger:+'// 必选
implementation 'androidx.appcompat:appcompat:1.3.1'//(最低版本)
// implementation 'com.umeng.umsdk:share-wx:7.1.5' //微信完整版
// implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.7.0'//微信官方依赖库,必选
//pdf
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
//支付宝支付相关
implementation 'com.alipay.sdk:alipaysdk-android:+@aar'
//商品评价星星
// implementation 'me.zhanghai.android.materialratingbar:library:1.4.0'
implementation 'com.google.android.material:material:1.6.0'
//图片选择器
implementation 'com.github.Mariovc:ImagePicker:1.2.2'
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
//zxing 依赖 二维码,扫描等使用
implementation 'com.google.zxing:core:3.4.1'
// implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
implementation 'com.github.maning0303:MNZXingCode:V2.1.9'
//高德地图3D
implementation 'com.amap.api:3dmap:latest.integration'
//该库专门用于在 ImageView 中处理 GIF 动画。
// implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23'
//微信支付SDK
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
//下载框架
implementation 'io.github.chiclaim:downloader:1.0.2'
implementation 'com.blankj:utilcodex:1.31.1'
// debugImplementation("com.reqable.android:user-certificate-trust:1.0.0")
implementation 'com.android.support:design:24.1.0'
//以下依赖都需要添加
implementation 'commons-codec:commons-codec:1.6'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.aliyun.dpa:oss-android-sdk:2.9.21' //阿里云oss
//图片裁剪
implementation 'com.github.yalantis:ucrop:2.2.6'
//XPopup 弹窗样式
implementation 'com.github.li-xiaojun:XPopup:2.10.0'
//处理 DeepSeek 返回的 markDown 格式
implementation 'io.noties.markwon:core:4.6.2'
//lottie动画依赖
implementation 'com.airbnb.android:lottie:6.4.0'
implementation 'cn.6tail:lunar:1.7.4'

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.kyzy.bazi">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
@@ -70,8 +69,10 @@
<meta-data
android:name="ScopedStorage"
android:value="true" />
<!-- 高德定位 SDK 依赖已移除
<service android:name="com.amap.api.location.APSService"
tools:ignore="MissingClass"></service>
-->
<activity
android:name="com.kyzy.bazi.guide.LaunchActivity"
@@ -82,6 +83,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- 微信 SDK 依赖已移除
<activity
android:name="com.kyzy.bazi.wxapi.WXPayEntryActivity"
android:exported="true"
@@ -93,6 +95,7 @@
<data android:scheme="wx66c35bc33549040a"/>
</intent-filter>
</activity>
-->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.kyzy.bazi.provider"
@@ -194,4 +197,4 @@
android:windowSoftInputMode="adjustResize"/>
</application>
</manifest>
</manifest>

View File

@@ -1,6 +1,6 @@
package com.kyzy.bazi;
import com.amap.api.location.AMapLocation;
//import com.amap.api.location.AMapLocation;
/**
@@ -18,7 +18,7 @@ public class EventMessage {
public int result_code;
public String eventStrKey;
public String msg;
public AMapLocation aMapLocation;
// public AMapLocation aMapLocation;
public String getEventStrKey() {
@@ -33,10 +33,12 @@ public class EventMessage {
this.msg = msg;
}
/* 高德定位依赖已移除
public EventMessage(String msg,AMapLocation aMapLocation) {
this.msg = msg;
this.aMapLocation = aMapLocation;
}
*/
public EventMessage(String eventStr, String msg) {
this.eventStrKey = eventStr;
@@ -65,4 +67,4 @@ public class EventMessage {
public void setMsg(String msg) {
this.msg = msg;
}
}
}

View File

@@ -40,7 +40,7 @@ import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.viewbinding.ViewBinding;
import com.amap.api.location.AMapLocationClient;
//import com.amap.api.location.AMapLocationClient;
import com.esafirm.imagepicker.features.ImagePicker;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.XXPermissions;
@@ -875,7 +875,7 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
AMapLocationClient.updatePrivacyAgree(mContext, true);
// AMapLocationClient.updatePrivacyAgree(mContext, true);
}
@Override
@@ -896,7 +896,7 @@ public abstract class BaseActivity<T extends ViewBinding, P extends IPresenter>
@Override
public void onGranted(List<String> permissions, boolean all) {
// 权限已授予,开始下载文件
AMapLocationClient.updatePrivacyAgree(mContext, true);
// AMapLocationClient.updatePrivacyAgree(mContext, true);
}
@Override

View File

@@ -3,7 +3,6 @@ package com.kyzy.bazi.chat.adapter;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -26,8 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.noties.markwon.Markwon;
/**
* @author fengxiaoyang
* @date 2025/7/7
@@ -41,8 +38,8 @@ public class IndexChatAdapter extends BaseMultiItemQuickAdapter<ChatMultiItem, B
//convert() 中每次绑定 item 时缓存 MarkdownStreamer 实例
private final Map<Integer, MarkdownStreamer> streamerMap = new HashMap<>();
// 新增:Markdown 解析器
private Markwon markwon;
// Markwon 依赖已移除
// private Markwon markwon;
// 新增:当前正在流式输出的位置
private int mCurrentStreamingPosition = -1;
@@ -56,7 +53,7 @@ public class IndexChatAdapter extends BaseMultiItemQuickAdapter<ChatMultiItem, B
super(data);
this.mContext = context;
this.recyclerView = recyclerView;
this.markwon = Markwon.create(context);
// this.markwon = Markwon.create(context);
addItemType(ChatMultiItem.TYPE_TEXT_LEFT, R.layout.item_text_left);
addItemType(ChatMultiItem.TYPE_TEXT_RIGHT, R.layout.item_text_right);
}
@@ -149,12 +146,8 @@ public class IndexChatAdapter extends BaseMultiItemQuickAdapter<ChatMultiItem, B
// 优化流式输出更新逻辑
if (position == mCurrentStreamingPosition) {
// 当前正在流式输出的位置
try {
Spanned spanned = markwon.toMarkdown(content);
tvContent.setText(spanned);
} catch (Exception e) {
tvContent.setText(content);
}
// Markwon 依赖已移除,直接显示原始内容
tvContent.setText(content);
// 显示停止标识(如果被停止)
if (stoppedPositions.containsKey(position) && stoppedPositions.get(position)) {
@@ -165,12 +158,8 @@ public class IndexChatAdapter extends BaseMultiItemQuickAdapter<ChatMultiItem, B
}
} else {
// 历史消息,直接显示完整内容
try {
Spanned spanned = markwon.toMarkdown(content);
tvContent.setText(spanned);
} catch (Exception e) {
tvContent.setText(content);
}
// Markwon 依赖已移除,直接显示原始内容
tvContent.setText(content);
// 历史消息也检查是否被停止
if (stoppedPositions.containsKey(position) && stoppedPositions.get(position)) {

View File

@@ -1,20 +1,15 @@
package com.kyzy.bazi.custom.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.Gravity;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.kyzy.bazi.R;
import com.lzj.sidebar.SideBarSortView;
public class SideBarLayout extends RelativeLayout implements SideBarSortView.OnIndexChangedListener {
private View mLayout;
private Context mContext;
private TextView mTvTips;
private SideBarSortView mSortView;
@@ -25,64 +20,59 @@ public class SideBarLayout extends RelativeLayout implements SideBarSortView.OnI
private int wordTextColor;
private float wordTextSize;
private Drawable wordBackground;
public SideBarLayout(Context context) {
super(context);
init(context);
initView();
}
public SideBarLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
init(context);
initView();
}
public SideBarLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
init(context);
initView();
}
private void init(Context context, AttributeSet attrs) {
private void init(Context context) {
mContext = context;
//获取自定义属性
if (attrs != null) {
TypedArray ta = mContext.obtainStyledAttributes(attrs, R.styleable.SideBarView);
unselectTextColor = ta.getColor(R.styleable.SideBarView_sidebarUnSelectTextColor, Color.parseColor("#999999"));
selectTextColor = ta.getColor(R.styleable.SideBarView_sidebarSelectTextColor, Color.parseColor("#2E56D7"));
selectTextSize = ta.getDimension(R.styleable.SideBarView_sidebarSelectTextSize, dip2px(mContext, 12));
unselectTextSize = ta.getDimension(R.styleable.SideBarView_sidebarUnSelectTextSize, dip2px(mContext, 10));
wordTextSize = ta.getDimension(R.styleable.SideBarView_sidebarWordTextSize, px2sp(mContext, 45));
wordTextColor = ta.getColor(R.styleable.SideBarView_sidebarWordTextColor, Color.parseColor("#FFFFFF"));
wordBackground = ta.getDrawable(R.styleable.SideBarView_sidebarWordBackground);
if (wordBackground == null) {
wordBackground = context.getResources().getDrawable(R.drawable.sort_text_view_hint_bg);
}
ta.recycle();
}
unselectTextColor = Color.parseColor("#999999");
selectTextColor = Color.parseColor("#2E56D7");
selectTextSize = dip2px(mContext, 12);
unselectTextSize = dip2px(mContext, 10);
wordTextSize = 45;
wordTextColor = Color.WHITE;
}
private void initView() {
//引入布局
mLayout = LayoutInflater.from(mContext).inflate(R.layout.view_sidebar_layout, null, true);
mTvTips = (TextView) mLayout.findViewById(R.id.tvTips);
mSortView = (SideBarSortView) mLayout.findViewById(R.id.sortView);
mSortView = new SideBarSortView(mContext);
mSortView.setIndexChangedListener(this);
mSortView.setmTextColor(unselectTextColor);
mSortView.setmTextSize(unselectTextSize);
mSortView.setmTextColorChoose(selectTextColor);
mSortView.setmTextSizeChoose(selectTextSize);
mSortView.invalidate();
LayoutParams sortViewParams = new LayoutParams(dip2px(mContext, 24), LayoutParams.MATCH_PARENT);
sortViewParams.addRule(ALIGN_PARENT_RIGHT);
addView(mSortView, sortViewParams);
mTvTips = new TextView(mContext);
mTvTips.setGravity(Gravity.CENTER);
mTvTips.setTextColor(wordTextColor);
mTvTips.setTextSize(px2sp(mContext, wordTextSize));
mTvTips.setBackground(wordBackground);
this.addView(mLayout); //将子布局添加到父容器,才显示控件
mTvTips.setBackground(new ColorDrawable(Color.parseColor("#B3000000")));
mTvTips.setVisibility(View.GONE);
int tipSize = dip2px(mContext, 56);
LayoutParams tipParams = new LayoutParams(tipSize, tipSize);
tipParams.addRule(CENTER_IN_PARENT);
addView(mTvTips, tipParams);
}
@@ -126,7 +116,7 @@ public class SideBarLayout extends RelativeLayout implements SideBarSortView.OnI
* @param word
*/
public void onItemScrollUpdateSideBarText(String word) {
if (mListener != null) {
if (mListener != null && mSortView != null) {
mSortView.onUpdateSideBarText(word);
}
}

View File

@@ -19,10 +19,10 @@ import android.view.animation.AccelerateDecelerateInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
//import com.amap.api.location.AMapLocation;
//import com.amap.api.location.AMapLocationClient;
//import com.amap.api.location.AMapLocationClientOption;
//import com.amap.api.location.AMapLocationListener;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.geocoder.GeocodeAddress;
@@ -89,9 +89,9 @@ public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
private TodayFateEntity mTodayEntity;
//声明AMapLocationClient类对象
public AMapLocationClient mLocationClient = null;
// public AMapLocationClient mLocationClient = null;
//声明AMapLocationClientOption对象
public AMapLocationClientOption mLocationOption = null;
// public AMapLocationClientOption mLocationOption = null;
// 添加动画执行标志位
private boolean isCareerAnimPlayed = false;
private boolean isLoveAnimPlayed = false;
@@ -153,8 +153,8 @@ public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
// AMapLocationClient.updatePrivacyAgree(mContext, true);
// initLocationInfo();
// }
AMapLocationClient.updatePrivacyAgree(mContext, true);
AMapLocationClient.updatePrivacyShow(mContext, true,true);
// AMapLocationClient.updatePrivacyAgree(mContext, true);
// AMapLocationClient.updatePrivacyShow(mContext, true,true);
// 设置当前日期和星期几
setCurrentDate();
@@ -759,6 +759,7 @@ public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
}
/* 高德定位依赖已移除
private void initLocationInfo() {
try {
// 初始化高德地图SDK
@@ -792,8 +793,10 @@ public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
e.printStackTrace();
}
}
*/
/* 高德定位依赖已移除
AMapLocationListener locationListener = new AMapLocationListener() {
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
@@ -805,6 +808,7 @@ public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
}
}
};
*/
private void getCurrentCityWeather(GeoPoiResponse response) {
@@ -812,8 +816,8 @@ public class FateFragment extends BaseFragment<FateLayoutBinding, FatePresenter>
@Override
public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
AMapLocationClient.updatePrivacyAgree(mContext, true);
initLocationInfo();
// AMapLocationClient.updatePrivacyAgree(mContext, true);
// initLocationInfo();
}
@Override

View File

@@ -18,7 +18,7 @@ import androidx.annotation.Nullable;
import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alipay.sdk.app.PayTask;
//import com.alipay.sdk.app.PayTask;
import com.bumptech.glide.Glide;
import com.esafirm.imagepicker.features.ImagePicker;
import com.esafirm.imagepicker.model.Image;

View File

@@ -1,9 +1,9 @@
package com.kyzy.bazi.utils;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
//import net.sourceforge.pinyin4j.PinyinHelper;
//import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
//import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
//import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
/**
* 汉字转换位汉语拼音,英文字符不变
@@ -17,6 +17,8 @@ public class Cn2Spell {
* 例如:阿飞→af
*/
public static String getPinYinHeadChar(String chines) {
// pinyin4j 依赖已移除
/*
sb.setLength(0);
char[] chars = chines.toCharArray();
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
@@ -34,12 +36,16 @@ public class Cn2Spell {
}
}
return sb.toString();
*/
return chines;
}
/**
* 获取汉字字符串的第一个字母
*/
public static String getPinYinFirstLetter(String str) {
// pinyin4j 依赖已移除
/*
sb.setLength(0);
char c = str.charAt(0);
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c);
@@ -49,12 +55,16 @@ public class Cn2Spell {
sb.append(c);
}
return sb.toString();
*/
return str.isEmpty() ? "" : String.valueOf(str.charAt(0));
}
/**
* 获取汉字字符串的汉语拼音,英文字符不变
*/
public static String getPinYin(String chines) {
// pinyin4j 依赖已移除
/*
sb.setLength(0);
char[] nameChar = chines.toCharArray();
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
@@ -72,6 +82,8 @@ public class Cn2Spell {
}
}
return sb.toString();
*/
return chines;
}
}

View File

@@ -4,12 +4,11 @@ import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.Spanned;
import android.text.SpannedString;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import io.noties.markwon.Markwon;
public class MarkdownStreamer {
private final TextView textView;
@@ -35,8 +34,8 @@ public class MarkdownStreamer {
public MarkdownStreamer(TextView textView, RecyclerView scrollView, String markdown, Context context) {
this.textView = textView;
this.scrollView = scrollView;
Markwon markwon = Markwon.create(context);
this.spannedText = markwon.toMarkdown(markdown);
// Markwon 依赖已移除,按纯文本进行流式显示
this.spannedText = new SpannedString(markdown);
}
public void startStreaming() {
@@ -78,4 +77,4 @@ public class MarkdownStreamer {
}
}
};
}
}

View File

@@ -1,19 +1,16 @@
package com.kyzy.bazi.utils.stream;
import android.content.Context;
import android.text.Spanned;
import android.view.View;
import android.widget.TextView;
import androidx.core.widget.NestedScrollView;
import io.noties.markwon.Markwon;
public class RealTimeMarkdownStreamer {
private final TextView textView;
private final NestedScrollView scrollView;
private final Context context;
private final Markwon markwon;
// Markwon 依赖已移除
private StringBuilder contentBuffer = new StringBuilder();
private boolean isProcessing = false;
@@ -22,7 +19,6 @@ public class RealTimeMarkdownStreamer {
this.textView = textView;
this.scrollView = scrollView;
this.context = context;
this.markwon = Markwon.create(context);
}
/**
@@ -38,17 +34,11 @@ public class RealTimeMarkdownStreamer {
contentBuffer.setLength(0);
contentBuffer.append(newContent);
// 尝试解析 Markdown
try {
Spanned spanned = markwon.toMarkdown(contentBuffer.toString());
textView.setText(spanned);
// 自动滚动到底部
scrollView.post(() -> scrollView.fullScroll(View.FOCUS_DOWN));
} catch (Exception e) {
// 如果 Markdown 解析失败,显示原始文本
textView.setText(contentBuffer.toString());
}
// Markwon 依赖已移除,直接显示原始文本
textView.setText(contentBuffer.toString());
// 自动滚动到底部
scrollView.post(() -> scrollView.fullScroll(View.FOCUS_DOWN));
isProcessing = false;
}
@@ -60,4 +50,4 @@ public class RealTimeMarkdownStreamer {
contentBuffer.setLength(0);
textView.setText("");
}
}
}

View File

@@ -9,27 +9,29 @@ import androidx.annotation.Nullable;
import com.kyzy.bazi.AppConfig;
import com.kyzy.bazi.EventMessage;
import com.kyzy.bazi.utils.show.ToastUtil;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
//import com.tencent.mm.opensdk.constants.ConstantsAPI;
//import com.tencent.mm.opensdk.modelbase.BaseReq;
//import com.tencent.mm.opensdk.modelbase.BaseResp;
//import com.tencent.mm.opensdk.openapi.IWXAPI;
//import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
//import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import de.greenrobot.event.EventBus;
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
public class WXPayEntryActivity extends Activity {
private IWXAPI api;
// private IWXAPI api;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//注册API 没有这个不会执行onResp
api = WXAPIFactory.createWXAPI(this, AppConfig.WX_APPID);
api.handleIntent(getIntent(), this);
// 微信 SDK 依赖已移除
// api = WXAPIFactory.createWXAPI(this, AppConfig.WX_APPID);
// api.handleIntent(getIntent(), this);
finish();
}
/* 微信 SDK 依赖已移除
@Override
public void onReq(BaseReq baseReq) {
if(baseReq != null){
@@ -56,11 +58,12 @@ public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
}
}
}
*/
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
// api.handleIntent(intent, this);
}
}

View File

@@ -5,6 +5,7 @@
<color name="colorAccent">#FF4081</color>
<color name="transparent">#00000000</color>
<color name="color_white">#FFFFFF</color>
<color name="white">#FFFFFF</color>
<color name="divider">#EEEEEE</color>
@@ -16,6 +17,9 @@
<color name="color_black1">#333333</color>
<color name="color_black">#000000</color>
<color name="color_E0E0E0">#E0E0E0</color>
<color name="black">#000000</color>
<color name="red">#DC143C</color>
<color name="gray_d4">#999999</color>
<color name="text_hint">#707070</color>