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

@@ -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);
}
}