update
This commit is contained in:
parent
728d700e54
commit
249568aa11
@ -136,6 +136,11 @@ public class MusicData {
|
||||
if (StringUtil.isEmpty(track)) {
|
||||
return "0";
|
||||
}
|
||||
try{
|
||||
Integer.parseInt(track);
|
||||
}catch (Exception e){
|
||||
return track.substring(0,1);
|
||||
}
|
||||
return track;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class MediaBrowserHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public class MediaBrowserSubscriptionCallback extends MediaBrowserCompat.SubscriptionCallback {
|
||||
public static class MediaBrowserSubscriptionCallback extends MediaBrowserCompat.SubscriptionCallback {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,9 @@ public class MusicService extends MediaBrowserServiceCompat {
|
||||
IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY);;
|
||||
|
||||
public void updateNotification() {
|
||||
|
||||
MediaMetadataCompat metadataCompat = MusicContainer.getInstance().getNowPlayMetadataCompat();
|
||||
System.out.println("更新通知栏:"+metadataCompat.getString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID));
|
||||
mediaSession.setMetadata(metadataCompat);
|
||||
mediaSession.setActive(true);
|
||||
Notification notification =
|
||||
|
@ -51,7 +51,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
private TextView positionTime, durationTime, bitRate;
|
||||
private SeekBar seekBar;
|
||||
private Handler handler;
|
||||
private KProgressHUD hud;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -64,11 +63,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
play.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (hud != null) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
hud = AppTools.showLoading(MainActivity.this);
|
||||
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -78,10 +73,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
} else {
|
||||
browserHelper.getTransportControls().play();
|
||||
}
|
||||
if (hud != null && hud.isShowing()) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -90,19 +81,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
next.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (hud != null) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
hud = AppTools.showLoading(MainActivity.this);
|
||||
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
browserHelper.getTransportControls().skipToNext();
|
||||
if (hud != null && hud.isShowing()) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -111,19 +95,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
previous.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (hud != null) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
hud = AppTools.showLoading(MainActivity.this);
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
browserHelper.getTransportControls().skipToPrevious();
|
||||
if (hud != null && hud.isShowing()) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -141,19 +116,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
if (hud != null) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
hud = AppTools.showLoading(MainActivity.this);
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (browserHelper.getTransportControls() != null)
|
||||
if (browserHelper.getTransportControls() != null) {
|
||||
browserHelper.getTransportControls().seekTo(MainActivity.this.seekBar.getProgress());
|
||||
if (hud != null && hud.isShowing()) {
|
||||
hud.dismiss();
|
||||
hud = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user