version:2.7
fix: update:优化爱心提醒,修改高度一致
This commit is contained in:
@@ -18,9 +18,14 @@ import com.uiui.aios.service.main.MainService;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -107,7 +112,7 @@ public class AlarmUtils {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<AlarmClockData> data = gson.fromJson(jsonString, type);
|
||||
HashMap hashMap = new HashMap();
|
||||
HashMap<Integer, AlarmClockData> hashMap = new HashMap<>();
|
||||
for (AlarmClockData clockData : data) {
|
||||
hashMap.put(clockData.getId(), clockData);
|
||||
}
|
||||
@@ -115,6 +120,41 @@ public class AlarmUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public List<AlarmClockData> getOldDataList() {
|
||||
String jsonString = mmkv.decodeString("AlarmClock", "");
|
||||
Log.e(TAG, "getOldPendingIntents: " + jsonString);
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
Type type = new TypeToken<List<AlarmClockData>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<AlarmClockData> data = gson.fromJson(jsonString, type);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public AlarmClockData getRecentAlarmClock() {
|
||||
List<AlarmClockData> alarmClockData = getOldDataList();
|
||||
if (alarmClockData == null || alarmClockData.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
Collections.sort(alarmClockData, new Comparator<AlarmClockData>() {
|
||||
DateFormat df = new SimpleDateFormat("HH:mm");
|
||||
|
||||
@Override
|
||||
public int compare(AlarmClockData o1, AlarmClockData o2) {
|
||||
try {
|
||||
return df.parse(o1.getTime()).compareTo(df.parse(o2.getTime()));
|
||||
} catch (ParseException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return alarmClockData.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<PendingIntent> getOldPendingIntents() {
|
||||
HashSet<PendingIntent> pendingIntents = new HashSet<>();
|
||||
HashMap<Integer, AlarmClockData> data = getOldData();
|
||||
@@ -246,7 +286,6 @@ public class AlarmUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ariaDownload(String url, String md5) {
|
||||
String fileName = Utils.getFileNamefromURL(url);
|
||||
File file = new File(Utils.getDownLoadPath(mContext) + fileName);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.uiui.aios.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
@@ -11,7 +13,7 @@ import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import wseemann.media.FFmpegMediaMetadataRetriever;
|
||||
|
||||
public class AudioUtils {
|
||||
public class FFmpegUtils {
|
||||
/**
|
||||
* 获取在线音频时间长度
|
||||
*
|
||||
@@ -34,4 +36,22 @@ public class AudioUtils {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(observer);
|
||||
}
|
||||
|
||||
public static void loadVideoScreenshot(String url, Observer<Bitmap> observer) {
|
||||
Observable.create(new ObservableOnSubscribe<Bitmap>() {
|
||||
@Override
|
||||
public void subscribe(@NonNull ObservableEmitter<Bitmap> emitter) throws Throwable {
|
||||
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
|
||||
mmr.setDataSource(url);
|
||||
mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM);
|
||||
mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ARTIST);
|
||||
Bitmap b = mmr.getFrameAtTime(2000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST); // frame at 2 seconds
|
||||
byte[] artwork = mmr.getEmbeddedPicture();
|
||||
mmr.release();
|
||||
emitter.onNext(b);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(observer);
|
||||
}
|
||||
}
|
||||
@@ -39,9 +39,9 @@ public class IconUtils {
|
||||
this.add("com.mediatek.fmradio");//收音机
|
||||
this.add("com.android.fmradio");//收音机
|
||||
this.add("com.android.email");//电子邮件
|
||||
this.add("com.ss.android.ugc.aweme");//抖音
|
||||
this.add("com.ss.android.article.news");//头条
|
||||
this.add("com.tencent.mm");//微信
|
||||
// this.add("com.ss.android.ugc.aweme");//抖音
|
||||
// this.add("com.ss.android.article.news");//头条
|
||||
// this.add("com.tencent.mm");//微信
|
||||
}};
|
||||
|
||||
public static List<String> appIconList = new ArrayList<String>() {{
|
||||
@@ -77,9 +77,9 @@ public class IconUtils {
|
||||
this.add("com_mediatek_fmradio");
|
||||
this.add("com_mediatek_fmradio");//收音机
|
||||
this.add("com_android_email");
|
||||
this.add("com_android_aweme2");
|
||||
this.add("com_android_news2");
|
||||
this.add("com_tencent_mm2");
|
||||
// this.add("com_android_aweme2");
|
||||
// this.add("com_android_news2");
|
||||
// this.add("com_tencent_mm2");
|
||||
}};
|
||||
|
||||
public static List<String> appIconList2 = new ArrayList<String>() {{
|
||||
|
||||
Reference in New Issue
Block a user