Skip to content

Commit

Permalink
3.34.5
Browse files Browse the repository at this point in the history
3.34.5
- 更好的API
- 修复无法输入 - 号
- 修复 歌词立马滚动的问题
- 修复 SP配置文件的闪退问题
- 移除 SP配置文件歌词统计
  • Loading branch information
577fkj authored Dec 3, 2021
2 parents bd819c2 + af42efd commit 0d04b46
Show file tree
Hide file tree
Showing 38 changed files with 949 additions and 1,052 deletions.
136 changes: 0 additions & 136 deletions Api/Api.java

This file was deleted.

131 changes: 0 additions & 131 deletions Api/Api.kt

This file was deleted.

25 changes: 25 additions & 0 deletions Api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# StatusBarAPi

[StatusBarApiExample](https://github.com/577fkj/StatusBarApiExample)

To use API, please increase the package statusbarsdk and ignore this package in the confusion

Add under application in AndroidManifest.xml
```xml
<meta-data
android:name="XStatusBarLyric"
android:value="true" />
```

# StatusBarAPi

[StatusBarApiExample](https://github.com/577fkj/StatusBarApiExample)

使用 API 请增加软件包 statusbarsdk 并在混淆里忽略此包

在AndroidManifest.xml 中的 application 下添加
```xml
<meta-data
android:name="XStatusBarLyric"
android:value="true" />
```
83 changes: 83 additions & 0 deletions Api/statusbarsdk/statusbarlyric.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package statusbarsdk;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Base64;

import java.io.ByteArrayOutputStream;

public class statusbarlyric {

String icon;
Context context;
boolean useSystemMusicActive;

/**
* InitStatusBarLyric / 初始化状态栏歌词 &nbsp;
* <p>
* Call {@link #sendLyric} to send lyrics, Call {@link #stopLyric} to clear (of course, your app will be cleared if killed), Call {@link #hasEnable} to determine whether to activate the Xposed module.
* </p><p>
* 调用{@link #sendLyric}发送歌词, 调用{@link #stopLyric}清除(当然你的应用被杀死也会清除), 调用{@link #hasEnable}判断是否激活模块.
* </p>
*
* @param context context
* @param drawable (notification) icon (you can use your music service's notification icon), Drawable, format should be webp. 通知栏图标(Webp格式,Drawable)
* @param useSystemMusicActive detect your music service running status via system. 是否使用系统检测音乐是否播放
*/
public statusbarlyric(Context context, Drawable drawable, boolean useSystemMusicActive) {
icon = drawableToBase64(drawable);
this.context = context;
this.useSystemMusicActive = useSystemMusicActive;
}

/**
* SendLyric / 发送歌词 &nbsp;
* <p>
* this function will broadcast a intent containing a single line lyrics, which would be displayed (and remained) on statusbar until you send another intent or you call {@link #stopLyric} manually or your app is killed.
* </p><p>
* 发送单行歌词的广播Intent, 歌词将一直停留在状态栏! 调用{@link #stopLyric}清除(当然你的应用被杀死也会清除)
* </p>
*
* @param lyric A single line lyrics 单行歌词
*/
public void updateLyric(String lyric) {
sendLyric(context, lyric, icon, useSystemMusicActive);
}

/**
* Whether to activate the Xposed module / 是否激活模块 &nbsp;
* <p>
* Get whether the Xposed module is activated for this software
* </p><p>
* 获取模块是否对本软件激活
* </p>
*/
public boolean hasEnable() {
return false;
}

/**
* StopLyric (useSystemMusicActive for 'true' No need to use) / 停止播放 (useSystemMusicActive 为 'true' 无需使用)
*/
public void stopLyric() {
stopLyric(context);
}

protected String drawableToBase64(Drawable drawable) {
if (drawable == null) {
return "";
}
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG,100,baos);
byte[] bytes = baos.toByteArray();
return Base64.encodeToString(bytes, Base64.DEFAULT);
}

protected void sendLyric(Context context, String lyric, String icon, boolean useSystemMusicActive) {}

protected void stopLyric(Context context) {}

}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@

## 音乐主动适配

请查看 Java [Api.java](https://github.com/577fkj/MIUIStatusBarLyric/blob/main/Api/Api.java)
请查看 Kotlin [Api.kt](https://github.com/577fkj/MIUIStatusBarLyric/blob/main/Api/Api.kt)
请查看 [Api](./Api)
3 changes: 1 addition & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,4 @@

## App active adaptation

please check Java [Api.java](https://github.com/577fkj/MIUIStatusBarLyric/blob/main/Api/Api.java)
please check Kotlin [Api.kt](https://github.com/577fkj/MIUIStatusBarLyric/blob/main/Api/Api.kt)
please check [Api](./Api)
Loading

0 comments on commit 0d04b46

Please sign in to comment.