Save the current queue async in an SQL database with an handler running on a background thread (issue #43). Also saving position inside the track now. Fixed a bug where the lockscreen and widget were not updated correctly when pressing play after opening the app for the first time after it was closed before.

This commit is contained in:
Karim Abou Zeid 2015-06-24 14:26:36 +02:00
commit fc2726bf42
5 changed files with 285 additions and 103 deletions

View file

@ -7,7 +7,6 @@ import com.crashlytics.android.Crashlytics;
import com.kabouzeid.gramophone.App;
import com.kabouzeid.gramophone.BuildConfig;
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
import com.kabouzeid.gramophone.misc.AppKeys;
import com.kabouzeid.gramophone.model.UIPreferenceChangedEvent;
import com.squareup.otto.Subscribe;
@ -26,7 +25,7 @@ public abstract class AbsBaseActivity extends AbsThemeActivity implements KabVie
@Override
protected void onCreate(Bundle savedInstanceState) {
if (!BuildConfig.DEBUG) Crashlytics.setString(AppKeys.CL_CURRENT_ACTIVITY, getTag());
if (!BuildConfig.DEBUG) Crashlytics.setString("Current activity", getTag());
super.onCreate(savedInstanceState);
try {
App.bus.register(uiPreferenceChangeListener);

View file

@ -48,9 +48,9 @@ public abstract class AbsPlaybackStatusActivity extends AbsBaseActivity {
}
final IntentFilter filter = new IntentFilter();
filter.addAction(MusicService.PLAYSTATE_CHANGED);
filter.addAction(MusicService.SHUFFLEMODE_CHANGED);
filter.addAction(MusicService.REPEATMODE_CHANGED);
filter.addAction(MusicService.PLAY_STATE_CHANGED);
filter.addAction(MusicService.SHUFFLE_MODE_CHANGED);
filter.addAction(MusicService.REPEAT_MODE_CHANGED);
filter.addAction(MusicService.META_CHANGED);
filter.addAction(MusicPlayerRemote.SERVICE_BOUND);
@ -81,13 +81,13 @@ public abstract class AbsPlaybackStatusActivity extends AbsBaseActivity {
case MusicService.META_CHANGED:
reference.get().onPlayingMetaChanged();
break;
case MusicService.PLAYSTATE_CHANGED:
case MusicService.PLAY_STATE_CHANGED:
reference.get().onPlayStateChanged();
break;
case MusicService.REPEATMODE_CHANGED:
case MusicService.REPEAT_MODE_CHANGED:
reference.get().onRepeatModeChanged();
break;
case MusicService.SHUFFLEMODE_CHANGED:
case MusicService.SHUFFLE_MODE_CHANGED:
reference.get().onShuffleModeChanged();
break;
case MusicPlayerRemote.SERVICE_BOUND: