use of com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent in project muzei by romannurik.
the class NextArtworkTileService method onStartListening.
@Override
public void onStartListening() {
// Start listening for source changes, which will include when a source
// starts or stops supporting the 'Next Artwork' command
mSourceContentObserver = new ContentObserver(null) {
@Override
public void onChange(final boolean selfChange, final Uri uri) {
updateTile();
}
};
getContentResolver().registerContentObserver(MuzeiContract.Sources.CONTENT_URI, true, mSourceContentObserver);
// Check if the wallpaper is currently active
EventBus.getDefault().register(this);
WallpaperActiveStateChangedEvent e = EventBus.getDefault().getStickyEvent(WallpaperActiveStateChangedEvent.class);
// This will call through to updateTile()
onEventMainThread(e);
}
use of com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent in project muzei by romannurik.
the class MuzeiActivity method onPostResume.
@Override
protected void onPostResume() {
super.onPostResume();
mPaused = false;
mConsecutiveLoadErrorCount = 0;
// update intro mode UI to latest wallpaper active state
WallpaperActiveStateChangedEvent e = EventBus.getDefault().getStickyEvent(WallpaperActiveStateChangedEvent.class);
if (e != null) {
onEventMainThread(e);
} else {
onEventMainThread(new WallpaperActiveStateChangedEvent(false));
}
updateUiMode();
mChromeContainerView.setVisibility((mUiMode == UI_MODE_ART_DETAIL) ? View.VISIBLE : View.GONE);
if (mStatusBarScrimView != null) {
mStatusBarScrimView.setVisibility((mUiMode == UI_MODE_ART_DETAIL) ? View.VISIBLE : View.GONE);
}
// Note: normally should use window animations for this, but there's a bug
// on Samsung devices where the wallpaper is animated along with the window for
// windows showing the wallpaper (the wallpaper _should_ be static, not part of
// the animation).
View decorView = getWindow().getDecorView();
decorView.setAlpha(0f);
decorView.animate().cancel();
decorView.animate().setStartDelay(500).alpha(1f).setDuration(300);
maybeUpdateArtDetailOpenedClosed();
NewWallpaperNotificationReceiver.markNotificationRead(this);
}
Aggregations