aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-04-10 02:00:46 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-04-10 02:00:46 +0000
commite5750e35b7945df6172868b153b325689c97e56e (patch)
tree9ee83879053b3039eb5a6e76d3281aab23af5b44
parent21e1fcdad905d7bb7ced74c21ce55d5a25d00453 (diff)
downloadinfinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.tar
infinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.tar.gz
infinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.tar.bz2
infinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.tar.lz
infinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.tar.xz
infinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.tar.zst
infinity-for-reddit-e5750e35b7945df6172868b153b325689c97e56e.zip
Fix unable to check anonymous subscription.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/AnonymousSubscriptionsActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java2
2 files changed, 12 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AnonymousSubscriptionsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AnonymousSubscriptionsActivity.java
index 2c40b1e8..f0e753b7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AnonymousSubscriptionsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AnonymousSubscriptionsActivity.java
@@ -3,10 +3,12 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
+import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
@@ -99,4 +101,13 @@ public class AnonymousSubscriptionsActivity extends BaseActivity {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
}
+
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ }
+ return false;
+ }
} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java
index d977f159..f6768d11 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java
@@ -16,7 +16,7 @@ public class CheckIsSubscribedToSubreddit {
if (!redditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
redditDataRoomDatabase.accountDao().insertAnonymousAccount();
}
- SubscribedSubredditData subscribedSubredditData = redditDataRoomDatabase.subscribedSubredditDao().getSubscribedSubreddit(subredditName, accountName);
+ SubscribedSubredditData subscribedSubredditData = redditDataRoomDatabase.subscribedSubredditDao().getSubscribedSubreddit(subredditName, accountName == null ? "-" : accountName);
handler.post(() -> {
if (subscribedSubredditData != null) {
checkIsSubscribedToSubredditListener.isSubscribed();