minor changes to playback interface
This commit is contained in:
parent
e55d87b684
commit
ab6c3a42ed
5 changed files with 27 additions and 30 deletions
|
|
@ -194,12 +194,6 @@ public class MultiPlayer implements Playback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
exoPlayer.release();
|
|
||||||
isReady = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pause() {
|
public void pause() {
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
|
|
@ -207,14 +201,14 @@ public class MultiPlayer implements Playback {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPlaying() {
|
public void stop() {
|
||||||
return isReady && isPlaying;
|
exoPlayer.release();
|
||||||
|
isReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int duration() {
|
public boolean isPlaying() {
|
||||||
if (!isReady) return -1;
|
return isReady && isPlaying;
|
||||||
return (int) exoPlayer.getDuration();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -224,13 +218,18 @@ public class MultiPlayer implements Playback {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int seek(int position) {
|
public int duration() {
|
||||||
exoPlayer.seekTo(position);
|
if (!isReady) return -1;
|
||||||
return position;
|
return (int) exoPlayer.getDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVolume(float volume) {
|
public void seek(int position) {
|
||||||
|
exoPlayer.seekTo(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void volume(float volume) {
|
||||||
exoPlayer.setVolume(volume);
|
exoPlayer.setVolume(volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -887,13 +887,9 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
|
|
||||||
public int seek(int millis) {
|
public int seek(int millis) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
try {
|
playback.seek(millis);
|
||||||
int newPosition = playback.seek(millis);
|
throttledSeekHandler.notifySeek();
|
||||||
throttledSeekHandler.notifySeek();
|
return millis;
|
||||||
return newPosition;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1064,22 +1060,22 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case DUCK:
|
case DUCK:
|
||||||
if (PreferenceUtil.getInstance(service).getAudioDucking()) {
|
if (PreferenceUtil.getInstance(service).getAudioDucking()) {
|
||||||
currentDuckVolume -= .05f;
|
currentDuckVolume -= 0.05f;
|
||||||
if (currentDuckVolume > .2f) {
|
if (currentDuckVolume > 0.2f) {
|
||||||
sendEmptyMessageDelayed(DUCK, 10);
|
sendEmptyMessageDelayed(DUCK, 10);
|
||||||
} else {
|
} else {
|
||||||
currentDuckVolume = .2f;
|
currentDuckVolume = 0.2f;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentDuckVolume = 1f;
|
currentDuckVolume = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
service.playback.setVolume(currentDuckVolume);
|
service.playback.volume(currentDuckVolume);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNDUCK:
|
case UNDUCK:
|
||||||
if (PreferenceUtil.getInstance(service).getAudioDucking()) {
|
if (PreferenceUtil.getInstance(service).getAudioDucking()) {
|
||||||
currentDuckVolume += .03f;
|
currentDuckVolume += 0.03f;
|
||||||
if (currentDuckVolume < 1f) {
|
if (currentDuckVolume < 1f) {
|
||||||
sendEmptyMessageDelayed(UNDUCK, 10);
|
sendEmptyMessageDelayed(UNDUCK, 10);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1089,7 +1085,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
currentDuckVolume = 1f;
|
currentDuckVolume = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
service.playback.setVolume(currentDuckVolume);
|
service.playback.volume(currentDuckVolume);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TRACK_WENT_TO_NEXT:
|
case TRACK_WENT_TO_NEXT:
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ public interface Playback {
|
||||||
|
|
||||||
int duration();
|
int duration();
|
||||||
|
|
||||||
int seek(int position);
|
void seek(int position);
|
||||||
|
|
||||||
void setVolume(float volume);
|
void volume(float volume);
|
||||||
|
|
||||||
interface PlaybackCallbacks {
|
interface PlaybackCallbacks {
|
||||||
void onTrackStarted();
|
void onTrackStarted();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ public abstract class AbsThemeActivity extends ATHToolbarActivity {
|
||||||
setTheme(PreferenceUtil.getInstance(this).getGeneralTheme());
|
setTheme(PreferenceUtil.getInstance(this).getGeneralTheme());
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this);
|
MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this);
|
||||||
ThemeStore.coloredNavigationBar(this);
|
|
||||||
|
if (!ThemeStore.coloredNavigationBar(this)) {
|
||||||
|
ThemeStore.editTheme(this).coloredNavigationBar(true).commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setDrawUnderStatusbar() {
|
protected void setDrawUnderStatusbar() {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class ThemeUtil {
|
public class ThemeUtil {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Palette generatePalette(Bitmap bitmap) {
|
public static Palette generatePalette(Bitmap bitmap) {
|
||||||
if (bitmap == null) return null;
|
if (bitmap == null) return null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue