feat: added bottomSheet for shared items on the home screen

This commit is contained in:
antonio 2023-09-17 16:42:07 +02:00
parent ebd1582d1c
commit 077d22167c
2 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,37 @@
package com.cappielloantonio.tempo.viewmodel;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import com.cappielloantonio.tempo.repository.SharingRepository;
import com.cappielloantonio.tempo.subsonic.models.Share;
public class ShareBottomSheetViewModel extends AndroidViewModel {
private final SharingRepository sharingRepository;
private Share share;
public ShareBottomSheetViewModel(@NonNull Application application) {
super(application);
sharingRepository = new SharingRepository();
}
public Share getShare() {
return share;
}
public void setShare(Share share) {
this.share = share;
}
public void updateShare(String description, long expires) {
sharingRepository.updateShare(share.getId(), description, expires);
}
public void deleteShare() {
sharingRepository.deleteShare(share.getId());
}
}