mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
Delete anonymous multireddit in ViewMultiredditDetailActivity.
This commit is contained in:
parent
d5f3761973
commit
1896b971cd
@ -39,6 +39,7 @@ import ml.docilealligator.infinityforreddit.R;
|
|||||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||||
import ml.docilealligator.infinityforreddit.SortType;
|
import ml.docilealligator.infinityforreddit.SortType;
|
||||||
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
|
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
|
||||||
|
import ml.docilealligator.infinityforreddit.asynctasks.DeleteMultiredditInDatabase;
|
||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTypeBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTypeBottomSheetFragment;
|
||||||
@ -159,7 +160,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
|||||||
setToolbarGoToTop(toolbar);
|
setToolbarGoToTop(toolbar);
|
||||||
|
|
||||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||||
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
|
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, "-");
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
||||||
@ -265,7 +266,15 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
|||||||
.setTitle(R.string.delete)
|
.setTitle(R.string.delete)
|
||||||
.setMessage(R.string.delete_multi_reddit_dialog_message)
|
.setMessage(R.string.delete_multi_reddit_dialog_message)
|
||||||
.setPositiveButton(R.string.delete, (dialogInterface, i)
|
.setPositiveButton(R.string.delete, (dialogInterface, i)
|
||||||
-> DeleteMultiReddit.deleteMultiReddit(mExecutor, new Handler(), mOauthRetrofit, mRedditDataRoomDatabase,
|
-> {
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
DeleteMultiredditInDatabase.deleteMultiredditInDatabase(mExecutor, new Handler(), mRedditDataRoomDatabase, mAccountName, multiPath,
|
||||||
|
() -> {
|
||||||
|
Toast.makeText(this, R.string.delete_multi_reddit_success, Toast.LENGTH_SHORT).show();
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
DeleteMultiReddit.deleteMultiReddit(mExecutor, new Handler(), mOauthRetrofit, mRedditDataRoomDatabase,
|
||||||
mAccessToken, mAccountName, multiPath, new DeleteMultiReddit.DeleteMultiRedditListener() {
|
mAccessToken, mAccountName, multiPath, new DeleteMultiReddit.DeleteMultiRedditListener() {
|
||||||
@Override
|
@Override
|
||||||
public void success() {
|
public void success() {
|
||||||
@ -280,7 +289,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
|||||||
Toast.makeText(ViewMultiRedditDetailActivity.this,
|
Toast.makeText(ViewMultiRedditDetailActivity.this,
|
||||||
R.string.delete_multi_reddit_failed, Toast.LENGTH_SHORT).show();
|
R.string.delete_multi_reddit_failed, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}))
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user