Search in sources :

Example 1 with Wallpaper

use of org.thoughtcrime.securesms.database.model.databaseprotos.Wallpaper in project Signal-Android by WhisperSystems.

the class WallpaperValues method setWallpaper.

public void setWallpaper(@NonNull Context context, @Nullable ChatWallpaper wallpaper) {
    Wallpaper currentWallpaper = getCurrentWallpaper();
    Uri currentUri = null;
    if (currentWallpaper != null && currentWallpaper.hasFile()) {
        currentUri = Uri.parse(currentWallpaper.getFile().getUri());
    }
    if (wallpaper != null) {
        putBlob(KEY_WALLPAPER, wallpaper.serialize().toByteArray());
    } else {
        getStore().beginWrite().remove(KEY_WALLPAPER).apply();
    }
    if (currentUri != null) {
        WallpaperStorage.onWallpaperDeselected(context, currentUri);
    }
}
Also used : Wallpaper(org.thoughtcrime.securesms.database.model.databaseprotos.Wallpaper) ChatWallpaper(org.thoughtcrime.securesms.wallpaper.ChatWallpaper) Uri(android.net.Uri)

Example 2 with Wallpaper

use of org.thoughtcrime.securesms.database.model.databaseprotos.Wallpaper in project Signal-Android by signalapp.

the class WallpaperValues method setWallpaper.

public void setWallpaper(@NonNull Context context, @Nullable ChatWallpaper wallpaper) {
    Wallpaper currentWallpaper = getCurrentWallpaper();
    Uri currentUri = null;
    if (currentWallpaper != null && currentWallpaper.hasFile()) {
        currentUri = Uri.parse(currentWallpaper.getFile().getUri());
    }
    if (wallpaper != null) {
        putBlob(KEY_WALLPAPER, wallpaper.serialize().toByteArray());
    } else {
        getStore().beginWrite().remove(KEY_WALLPAPER).apply();
    }
    if (currentUri != null) {
        WallpaperStorage.onWallpaperDeselected(context, currentUri);
    }
}
Also used : Wallpaper(org.thoughtcrime.securesms.database.model.databaseprotos.Wallpaper) ChatWallpaper(org.thoughtcrime.securesms.wallpaper.ChatWallpaper) Uri(android.net.Uri)

Aggregations

Uri (android.net.Uri)2 Wallpaper (org.thoughtcrime.securesms.database.model.databaseprotos.Wallpaper)2 ChatWallpaper (org.thoughtcrime.securesms.wallpaper.ChatWallpaper)2