feat: 系统功能抽象

This commit is contained in:
2026-05-08 00:26:27 +08:00
parent b0ea6eff0a
commit 4dcb82b9f4
82 changed files with 4758 additions and 1019 deletions

View File

@@ -3,7 +3,6 @@ package com.ttstd.dialer.manager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.qweather.sdk.Callback;
@@ -59,7 +58,7 @@ public class WeatherManager {
.setLogEnable(BuildConfig.DEBUG) // 启用调试日志(生产环境建议设置为 false
.setTokenGenerator(jwt);
} catch (Throwable e) {
Log.e(TAG, "QWeatherUtils: " + e.getMessage());
Logger.e(TAG, "QWeatherUtils: " + e.getMessage());
e.printStackTrace();
}
}
@@ -72,7 +71,7 @@ public class WeatherManager {
public static WeatherManager getInstance() {
if (INSTANCE == null) {
throw new IllegalStateException("You must be init WeatherManager first");
throw new IllegalStateException("You must first initialize the WeatherManager");
}
return INSTANCE;
}
@@ -99,7 +98,7 @@ public class WeatherManager {
public void subscribe(@NonNull ObservableEmitter<List<CityInfo>> emitter) throws Throwable {
long time = System.currentTimeMillis();
List<CityInfo> cityInfos = CsvDeserializer.deserializeFromAssets(mContext, "China-City-List-latest.csv");
Log.e(TAG, "subscribe: deserializeFromAssets time = " + (System.currentTimeMillis() - time) + "ms");
Logger.e(TAG, "subscribe: deserializeFromAssets time = " + (System.currentTimeMillis() - time) + "ms");
emitter.onNext(cityInfos);
}
})
@@ -152,7 +151,7 @@ public class WeatherManager {
public void getWeatherNow(String adCode, Callback<WeatherNowResponse> callback) {
String locationID = getLocationID(adCode);
Log.e(TAG, "getWeatherNow: locationID = " + locationID);
Logger.e(TAG, "getWeatherNow: locationID = " + locationID);
WeatherParameter parameter = new WeatherParameter(locationID)
.lang(Lang.ZH_HANS)
.unit(Unit.METRIC);
@@ -161,7 +160,7 @@ public class WeatherManager {
public void getWeather24h(String adCode, Callback<WeatherHourlyResponse> callback) {
String locationID = getLocationID(adCode);
Log.e(TAG, "getWeatherNow: locationID = " + locationID);
Logger.e(TAG, "getWeatherNow: locationID = " + locationID);
WeatherParameter parameter = new WeatherParameter(locationID)
.lang(Lang.ZH_HANS)
.unit(Unit.METRIC);
@@ -170,7 +169,7 @@ public class WeatherManager {
public void getWeather10D(String adCode, Callback<WeatherDailyResponse> callback) {
String locationID = getLocationID(adCode);
Log.e(TAG, "getWeather10D: locationID = " + locationID);
Logger.e(TAG, "getWeather10D: locationID = " + locationID);
WeatherParameter parameter = new WeatherParameter(locationID)
.lang(Lang.ZH_HANS)
.unit(Unit.METRIC);