Search in sources :

Example 1 with WallpaperActiveStateChangedEvent

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);
}
Also used : WallpaperActiveStateChangedEvent(com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent) Uri(android.net.Uri) ContentObserver(android.database.ContentObserver)

Example 2 with WallpaperActiveStateChangedEvent

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);
}
Also used : WallpaperActiveStateChangedEvent(com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent) ImageView(android.widget.ImageView) View(android.view.View) AnimatedMuzeiLoadingSpinnerView(com.google.android.apps.muzei.util.AnimatedMuzeiLoadingSpinnerView) TextView(android.widget.TextView) PanScaleProxyView(com.google.android.apps.muzei.util.PanScaleProxyView)

Aggregations

WallpaperActiveStateChangedEvent (com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent)2 ContentObserver (android.database.ContentObserver)1 Uri (android.net.Uri)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 AnimatedMuzeiLoadingSpinnerView (com.google.android.apps.muzei.util.AnimatedMuzeiLoadingSpinnerView)1 PanScaleProxyView (com.google.android.apps.muzei.util.PanScaleProxyView)1