On sleep timer about to expire, lower volume even more
This commit is contained in:
parent
771b1e2a16
commit
98a6ab144b
|
@ -19,7 +19,6 @@ import android.media.MediaMetadataRetriever;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.media.RemoteControlClient;
|
import android.media.RemoteControlClient;
|
||||||
import android.media.RemoteControlClient.MetadataEditor;
|
import android.media.RemoteControlClient.MetadataEditor;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
@ -33,12 +32,9 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation;
|
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@ -406,7 +402,7 @@ public class PlaybackService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSleepTimerAlmostExpired() {
|
public void onSleepTimerAlmostExpired() {
|
||||||
mediaPlayer.setVolume(0.5f);
|
mediaPlayer.setVolume(0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -350,8 +350,6 @@ public class PlaybackServiceTaskManager {
|
||||||
waitingTime -= now - lastTick;
|
waitingTime -= now - lastTick;
|
||||||
lastTick = now;
|
lastTick = now;
|
||||||
|
|
||||||
Log.d(TAG, "time left: " + waitingTime);
|
|
||||||
|
|
||||||
if(waitingTime < NOTIFICATION_THRESHOLD && !notifiedAlmostExpired) {
|
if(waitingTime < NOTIFICATION_THRESHOLD && !notifiedAlmostExpired) {
|
||||||
Log.d(TAG, "Sleep timer is about to expire");
|
Log.d(TAG, "Sleep timer is about to expire");
|
||||||
if(vibrate) {
|
if(vibrate) {
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class ShakeListener implements SensorEventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resume() {
|
public void resume() {
|
||||||
|
// only a precaution, the user should actually not be able to activate shake to reset
|
||||||
|
// when the accelerometer is not available
|
||||||
mSensorMgr = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
|
mSensorMgr = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
|
||||||
if (mSensorMgr == null) {
|
if (mSensorMgr == null) {
|
||||||
throw new UnsupportedOperationException("Sensors not supported");
|
throw new UnsupportedOperationException("Sensors not supported");
|
||||||
|
|
Loading…
Reference in New Issue