-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3.34.5 - 更好的API - 修复无法输入 - 号 - 修复 歌词立马滚动的问题 - 修复 SP配置文件的闪退问题 - 移除 SP配置文件歌词统计
- Loading branch information
Showing
38 changed files
with
949 additions
and
1,052 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 / 初始化状态栏歌词 | ||
* <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 / 发送歌词 | ||
* <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 / 是否激活模块 | ||
* <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) {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.