mirror of
https://github.com/readrops/Readrops.git
synced 2025-01-31 10:54:53 +01:00
Add confirmation dialog for feed deletion
This commit is contained in:
parent
767139d1ce
commit
f7a0ef47fe
@ -56,20 +56,7 @@ public class ManageFeedsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDelete(FeedWithFolder feedWithFolder) {
|
public void onDelete(FeedWithFolder feedWithFolder) {
|
||||||
viewModel.deleteFeed(feedWithFolder.getFeed().getId())
|
deleteFolder(feedWithFolder.getFeed().getId());
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new DisposableCompletableObserver() {
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
Toast.makeText(getApplication(), "feed deleted", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
Toast.makeText(getApplication(), "error on feed deletion", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -93,20 +80,7 @@ public class ManageFeedsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDelete(FeedWithFolder feedWithFolder) {
|
public void onDelete(FeedWithFolder feedWithFolder) {
|
||||||
viewModel.deleteFeed(feedWithFolder.getFeed().getId())
|
deleteFolder(feedWithFolder.getFeed().getId());
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new DisposableCompletableObserver() {
|
|
||||||
@Override
|
|
||||||
public void onComplete() {
|
|
||||||
Toast.makeText(getApplication(), "feed deleted", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
Toast.makeText(getApplication(), "error on feed deletion", Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -153,6 +127,28 @@ public class ManageFeedsActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteFolder(int feedId) {
|
||||||
|
new MaterialDialog.Builder(this)
|
||||||
|
.title(getString(R.string.delete_feed))
|
||||||
|
.positiveText(getString(R.string.validate))
|
||||||
|
.negativeText(getString(R.string.cancel))
|
||||||
|
.onPositive((dialog, which) -> viewModel.deleteFeed(feedId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new DisposableCompletableObserver() {
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Toast.makeText(getApplication(), "feed deleted", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
Toast.makeText(getApplication(), "error on feed deletion", Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void openEditFeedDialog(FeedWithFolder feedWithFolder) {
|
private void openEditFeedDialog(FeedWithFolder feedWithFolder) {
|
||||||
EditFeedDialog editFeedDialog = new EditFeedDialog();
|
EditFeedDialog editFeedDialog = new EditFeedDialog();
|
||||||
|
|
||||||
|
@ -28,5 +28,7 @@
|
|||||||
<string name="edit_feed">Modifier le flux</string>
|
<string name="edit_feed">Modifier le flux</string>
|
||||||
<string name="folder">Dossier</string>
|
<string name="folder">Dossier</string>
|
||||||
<string name="no_folder">Pas de dossier</string>
|
<string name="no_folder">Pas de dossier</string>
|
||||||
|
<string name="cancel">Retour</string>
|
||||||
|
<string name="delete_feed">Supprimer le flux ?</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -30,4 +30,6 @@
|
|||||||
<string name="edit_feed">Edit feed</string>
|
<string name="edit_feed">Edit feed</string>
|
||||||
<string name="folder">Folder</string>
|
<string name="folder">Folder</string>
|
||||||
<string name="no_folder">No folder</string>
|
<string name="no_folder">No folder</string>
|
||||||
|
<string name="cancel">Cancel</string>
|
||||||
|
<string name="delete_feed">Delete feed ?</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user